/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Op Definitions *| |* *| |* Automatically generated file, do not edit! *| |* From: SPIRVOps.td *| |* *| \*===----------------------------------------------------------------------===*/ #ifdef GET_OP_LIST #undef GET_OP_LIST ::mlir::spirv::AccessChainOp, ::mlir::spirv::AddressOfOp, ::mlir::spirv::AllOp, ::mlir::spirv::AnyOp, ::mlir::spirv::AtomicAndOp, ::mlir::spirv::AtomicCompareExchangeOp, ::mlir::spirv::AtomicCompareExchangeWeakOp, ::mlir::spirv::AtomicExchangeOp, ::mlir::spirv::AtomicIAddOp, ::mlir::spirv::AtomicIDecrementOp, ::mlir::spirv::AtomicIIncrementOp, ::mlir::spirv::AtomicISubOp, ::mlir::spirv::AtomicLoadOp, ::mlir::spirv::AtomicOrOp, ::mlir::spirv::AtomicSMaxOp, ::mlir::spirv::AtomicSMinOp, ::mlir::spirv::AtomicStoreOp, ::mlir::spirv::AtomicUMaxOp, ::mlir::spirv::AtomicUMinOp, ::mlir::spirv::AtomicXorOp, ::mlir::spirv::BitCountOp, ::mlir::spirv::BitFieldInsertOp, ::mlir::spirv::BitFieldSExtractOp, ::mlir::spirv::BitFieldUExtractOp, ::mlir::spirv::BitReverseOp, ::mlir::spirv::BitcastOp, ::mlir::spirv::BitwiseAndOp, ::mlir::spirv::BitwiseOrOp, ::mlir::spirv::BitwiseXorOp, ::mlir::spirv::BranchConditionalOp, ::mlir::spirv::BranchOp, ::mlir::spirv::CLAcosOp, ::mlir::spirv::CLAcoshOp, ::mlir::spirv::CLAsinOp, ::mlir::spirv::CLAsinhOp, ::mlir::spirv::CLAtan2Op, ::mlir::spirv::CLAtanOp, ::mlir::spirv::CLAtanhOp, ::mlir::spirv::CLCbrtOp, ::mlir::spirv::CLCeilOp, ::mlir::spirv::CLClzOp, ::mlir::spirv::CLCosOp, ::mlir::spirv::CLCoshOp, ::mlir::spirv::CLErfOp, ::mlir::spirv::CLErfcOp, ::mlir::spirv::CLExp10Op, ::mlir::spirv::CLExp2Op, ::mlir::spirv::CLExpOp, ::mlir::spirv::CLExpm1Op, ::mlir::spirv::CLFAbsOp, ::mlir::spirv::CLFMaxOp, ::mlir::spirv::CLFMinOp, ::mlir::spirv::CLFloorOp, ::mlir::spirv::CLFmaOp, ::mlir::spirv::CLLdexpOp, ::mlir::spirv::CLLog10Op, ::mlir::spirv::CLLog1pOp, ::mlir::spirv::CLLog2Op, ::mlir::spirv::CLLogOp, ::mlir::spirv::CLMixOp, ::mlir::spirv::CLPowOp, ::mlir::spirv::CLPownOp, ::mlir::spirv::CLPrintfOp, ::mlir::spirv::CLRintOp, ::mlir::spirv::CLRootnOp, ::mlir::spirv::CLRoundOp, ::mlir::spirv::CLRsqrtOp, ::mlir::spirv::CLSAbsOp, ::mlir::spirv::CLSMaxOp, ::mlir::spirv::CLSMinOp, ::mlir::spirv::CLSinOp, ::mlir::spirv::CLSinhOp, ::mlir::spirv::CLSqrtOp, ::mlir::spirv::CLTanOp, ::mlir::spirv::CLTanhOp, ::mlir::spirv::CLTruncOp, ::mlir::spirv::CLUMaxOp, ::mlir::spirv::CLUMinOp, ::mlir::spirv::CompositeConstructOp, ::mlir::spirv::CompositeExtractOp, ::mlir::spirv::CompositeInsertOp, ::mlir::spirv::ConstantOp, ::mlir::spirv::ControlBarrierOp, ::mlir::spirv::ConvertFToSOp, ::mlir::spirv::ConvertFToUOp, ::mlir::spirv::ConvertPtrToUOp, ::mlir::spirv::ConvertSToFOp, ::mlir::spirv::ConvertUToFOp, ::mlir::spirv::ConvertUToPtrOp, ::mlir::spirv::CopyMemoryOp, ::mlir::spirv::DotOp, ::mlir::spirv::EXTAtomicFAddOp, ::mlir::spirv::EXTConstantCompositeReplicateOp, ::mlir::spirv::EXTEmitMeshTasksOp, ::mlir::spirv::EXTSetMeshOutputsOp, ::mlir::spirv::EXTSpecConstantCompositeReplicateOp, ::mlir::spirv::EmitVertexOp, ::mlir::spirv::EndPrimitiveOp, ::mlir::spirv::EntryPointOp, ::mlir::spirv::ExecutionModeIdOp, ::mlir::spirv::ExecutionModeOp, ::mlir::spirv::ExperimentalMLCallOp, ::mlir::spirv::FAddOp, ::mlir::spirv::FConvertOp, ::mlir::spirv::FDivOp, ::mlir::spirv::FModOp, ::mlir::spirv::FMulOp, ::mlir::spirv::FNegateOp, ::mlir::spirv::FOrdEqualOp, ::mlir::spirv::FOrdGreaterThanEqualOp, ::mlir::spirv::FOrdGreaterThanOp, ::mlir::spirv::FOrdLessThanEqualOp, ::mlir::spirv::FOrdLessThanOp, ::mlir::spirv::FOrdNotEqualOp, ::mlir::spirv::FRemOp, ::mlir::spirv::FSubOp, ::mlir::spirv::FUnordEqualOp, ::mlir::spirv::FUnordGreaterThanEqualOp, ::mlir::spirv::FUnordGreaterThanOp, ::mlir::spirv::FUnordLessThanEqualOp, ::mlir::spirv::FUnordLessThanOp, ::mlir::spirv::FUnordNotEqualOp, ::mlir::spirv::FuncOp, ::mlir::spirv::FunctionCallOp, ::mlir::spirv::GLAcosOp, ::mlir::spirv::GLAcoshOp, ::mlir::spirv::GLAsinOp, ::mlir::spirv::GLAsinhOp, ::mlir::spirv::GLAtan2Op, ::mlir::spirv::GLAtanOp, ::mlir::spirv::GLAtanhOp, ::mlir::spirv::GLCeilOp, ::mlir::spirv::GLCosOp, ::mlir::spirv::GLCoshOp, ::mlir::spirv::GLCrossOp, ::mlir::spirv::GLDegreesOp, ::mlir::spirv::GLDistanceOp, ::mlir::spirv::GLExp2Op, ::mlir::spirv::GLExpOp, ::mlir::spirv::GLFAbsOp, ::mlir::spirv::GLFClampOp, ::mlir::spirv::GLFMaxOp, ::mlir::spirv::GLFMinOp, ::mlir::spirv::GLFMixOp, ::mlir::spirv::GLFSignOp, ::mlir::spirv::GLFindILsbOp, ::mlir::spirv::GLFindSMsbOp, ::mlir::spirv::GLFindUMsbOp, ::mlir::spirv::GLFloorOp, ::mlir::spirv::GLFmaOp, ::mlir::spirv::GLFractOp, ::mlir::spirv::GLFrexpStructOp, ::mlir::spirv::GLInverseSqrtOp, ::mlir::spirv::GLLdexpOp, ::mlir::spirv::GLLengthOp, ::mlir::spirv::GLLog2Op, ::mlir::spirv::GLLogOp, ::mlir::spirv::GLNormalizeOp, ::mlir::spirv::GLPackHalf2x16Op, ::mlir::spirv::GLPackSnorm4x8Op, ::mlir::spirv::GLPowOp, ::mlir::spirv::GLRadiansOp, ::mlir::spirv::GLReflectOp, ::mlir::spirv::GLRoundEvenOp, ::mlir::spirv::GLRoundOp, ::mlir::spirv::GLSAbsOp, ::mlir::spirv::GLSClampOp, ::mlir::spirv::GLSMaxOp, ::mlir::spirv::GLSMinOp, ::mlir::spirv::GLSSignOp, ::mlir::spirv::GLSinOp, ::mlir::spirv::GLSinhOp, ::mlir::spirv::GLSqrtOp, ::mlir::spirv::GLTanOp, ::mlir::spirv::GLTanhOp, ::mlir::spirv::GLTruncOp, ::mlir::spirv::GLUClampOp, ::mlir::spirv::GLUMaxOp, ::mlir::spirv::GLUMinOp, ::mlir::spirv::GLUnpackHalf2x16Op, ::mlir::spirv::GLUnpackSnorm4x8Op, ::mlir::spirv::GenericCastToPtrExplicitOp, ::mlir::spirv::GenericCastToPtrOp, ::mlir::spirv::GlobalVariableOp, ::mlir::spirv::GraphARMOp, ::mlir::spirv::GraphConstantARMOp, ::mlir::spirv::GraphEntryPointARMOp, ::mlir::spirv::GraphOutputsARMOp, ::mlir::spirv::GroupBroadcastOp, ::mlir::spirv::GroupFAddOp, ::mlir::spirv::GroupFMaxOp, ::mlir::spirv::GroupFMinOp, ::mlir::spirv::GroupFMulKHROp, ::mlir::spirv::GroupIAddOp, ::mlir::spirv::GroupIMulKHROp, ::mlir::spirv::GroupNonUniformAllEqualOp, ::mlir::spirv::GroupNonUniformAllOp, ::mlir::spirv::GroupNonUniformAnyOp, ::mlir::spirv::GroupNonUniformBallotBitCountOp, ::mlir::spirv::GroupNonUniformBallotFindLSBOp, ::mlir::spirv::GroupNonUniformBallotFindMSBOp, ::mlir::spirv::GroupNonUniformBallotOp, ::mlir::spirv::GroupNonUniformBitwiseAndOp, ::mlir::spirv::GroupNonUniformBitwiseOrOp, ::mlir::spirv::GroupNonUniformBitwiseXorOp, ::mlir::spirv::GroupNonUniformBroadcastFirstOp, ::mlir::spirv::GroupNonUniformBroadcastOp, ::mlir::spirv::GroupNonUniformElectOp, ::mlir::spirv::GroupNonUniformFAddOp, ::mlir::spirv::GroupNonUniformFMaxOp, ::mlir::spirv::GroupNonUniformFMinOp, ::mlir::spirv::GroupNonUniformFMulOp, ::mlir::spirv::GroupNonUniformIAddOp, ::mlir::spirv::GroupNonUniformIMulOp, ::mlir::spirv::GroupNonUniformLogicalAndOp, ::mlir::spirv::GroupNonUniformLogicalOrOp, ::mlir::spirv::GroupNonUniformLogicalXorOp, ::mlir::spirv::GroupNonUniformQuadSwapOp, ::mlir::spirv::GroupNonUniformRotateKHROp, ::mlir::spirv::GroupNonUniformSMaxOp, ::mlir::spirv::GroupNonUniformSMinOp, ::mlir::spirv::GroupNonUniformShuffleDownOp, ::mlir::spirv::GroupNonUniformShuffleOp, ::mlir::spirv::GroupNonUniformShuffleUpOp, ::mlir::spirv::GroupNonUniformShuffleXorOp, ::mlir::spirv::GroupNonUniformUMaxOp, ::mlir::spirv::GroupNonUniformUMinOp, ::mlir::spirv::GroupSMaxOp, ::mlir::spirv::GroupSMinOp, ::mlir::spirv::GroupUMaxOp, ::mlir::spirv::GroupUMinOp, ::mlir::spirv::IAddCarryOp, ::mlir::spirv::IAddOp, ::mlir::spirv::IEqualOp, ::mlir::spirv::IMulOp, ::mlir::spirv::INTELControlBarrierArriveOp, ::mlir::spirv::INTELControlBarrierWaitOp, ::mlir::spirv::INTELConvertBF16ToFOp, ::mlir::spirv::INTELConvertFToBF16Op, ::mlir::spirv::INTELMaskedGatherOp, ::mlir::spirv::INTELMaskedScatterOp, ::mlir::spirv::INTELRoundFToTF32Op, ::mlir::spirv::INTELSubgroupBlockReadOp, ::mlir::spirv::INTELSubgroupBlockWriteOp, ::mlir::spirv::INotEqualOp, ::mlir::spirv::ISubBorrowOp, ::mlir::spirv::ISubOp, ::mlir::spirv::ImageDrefGatherOp, ::mlir::spirv::ImageFetchOp, ::mlir::spirv::ImageOp, ::mlir::spirv::ImageQuerySizeOp, ::mlir::spirv::ImageReadOp, ::mlir::spirv::ImageSampleExplicitLodOp, ::mlir::spirv::ImageSampleImplicitLodOp, ::mlir::spirv::ImageSampleProjDrefImplicitLodOp, ::mlir::spirv::ImageWriteOp, ::mlir::spirv::InBoundsPtrAccessChainOp, ::mlir::spirv::IsFiniteOp, ::mlir::spirv::IsInfOp, ::mlir::spirv::IsNanOp, ::mlir::spirv::IsNormalOp, ::mlir::spirv::KHRAssumeTrueOp, ::mlir::spirv::KHRCooperativeMatrixLengthOp, ::mlir::spirv::KHRCooperativeMatrixLoadOp, ::mlir::spirv::KHRCooperativeMatrixMulAddOp, ::mlir::spirv::KHRCooperativeMatrixStoreOp, ::mlir::spirv::KHRExpectOp, ::mlir::spirv::KHRSubgroupBallotOp, ::mlir::spirv::KillOp, ::mlir::spirv::LoadOp, ::mlir::spirv::LogicalAndOp, ::mlir::spirv::LogicalEqualOp, ::mlir::spirv::LogicalNotEqualOp, ::mlir::spirv::LogicalNotOp, ::mlir::spirv::LogicalOrOp, ::mlir::spirv::LoopOp, ::mlir::spirv::MatrixTimesMatrixOp, ::mlir::spirv::MatrixTimesScalarOp, ::mlir::spirv::MatrixTimesVectorOp, ::mlir::spirv::MemoryBarrierOp, ::mlir::spirv::MemoryNamedBarrierOp, ::mlir::spirv::MergeOp, ::mlir::spirv::ModuleOp, ::mlir::spirv::NamedBarrierInitializeOp, ::mlir::spirv::NotOp, ::mlir::spirv::OrderedOp, ::mlir::spirv::OuterProductOp, ::mlir::spirv::PtrAccessChainOp, ::mlir::spirv::PtrCastToGenericOp, ::mlir::spirv::ReferenceOfOp, ::mlir::spirv::ReturnOp, ::mlir::spirv::ReturnValueOp, ::mlir::spirv::SConvertOp, ::mlir::spirv::SDivOp, ::mlir::spirv::SDotAccSatOp, ::mlir::spirv::SDotOp, ::mlir::spirv::SGreaterThanEqualOp, ::mlir::spirv::SGreaterThanOp, ::mlir::spirv::SLessThanEqualOp, ::mlir::spirv::SLessThanOp, ::mlir::spirv::SModOp, ::mlir::spirv::SMulExtendedOp, ::mlir::spirv::SNegateOp, ::mlir::spirv::SRemOp, ::mlir::spirv::SUDotAccSatOp, ::mlir::spirv::SUDotOp, ::mlir::spirv::SampledImageOp, ::mlir::spirv::SelectOp, ::mlir::spirv::SelectionOp, ::mlir::spirv::ShiftLeftLogicalOp, ::mlir::spirv::ShiftRightArithmeticOp, ::mlir::spirv::ShiftRightLogicalOp, ::mlir::spirv::SpecConstantCompositeOp, ::mlir::spirv::SpecConstantOp, ::mlir::spirv::SpecConstantOperationOp, ::mlir::spirv::StoreOp, ::mlir::spirv::SwitchOp, ::mlir::spirv::TosaAbsOp, ::mlir::spirv::TosaAddOp, ::mlir::spirv::TosaArgMaxOp, ::mlir::spirv::TosaArithmeticRightShiftOp, ::mlir::spirv::TosaAvgPool2DOp, ::mlir::spirv::TosaBitwiseAndOp, ::mlir::spirv::TosaBitwiseNotOp, ::mlir::spirv::TosaBitwiseOrOp, ::mlir::spirv::TosaBitwiseXorOp, ::mlir::spirv::TosaCastOp, ::mlir::spirv::TosaCeilOp, ::mlir::spirv::TosaClampOp, ::mlir::spirv::TosaClzOp, ::mlir::spirv::TosaConcatOp, ::mlir::spirv::TosaConv2DOp, ::mlir::spirv::TosaConv3DOp, ::mlir::spirv::TosaCosOp, ::mlir::spirv::TosaDepthwiseConv2DOp, ::mlir::spirv::TosaEqualOp, ::mlir::spirv::TosaErfOp, ::mlir::spirv::TosaExpOp, ::mlir::spirv::TosaFFT2DOp, ::mlir::spirv::TosaFloorOp, ::mlir::spirv::TosaGatherOp, ::mlir::spirv::TosaGreaterEqualOp, ::mlir::spirv::TosaGreaterOp, ::mlir::spirv::TosaIntDivOp, ::mlir::spirv::TosaLogOp, ::mlir::spirv::TosaLogicalAndOp, ::mlir::spirv::TosaLogicalLeftShiftOp, ::mlir::spirv::TosaLogicalNotOp, ::mlir::spirv::TosaLogicalOrOp, ::mlir::spirv::TosaLogicalRightShiftOp, ::mlir::spirv::TosaLogicalXorOp, ::mlir::spirv::TosaMatMulOp, ::mlir::spirv::TosaMaxPool2DOp, ::mlir::spirv::TosaMaximumOp, ::mlir::spirv::TosaMinimumOp, ::mlir::spirv::TosaMulOp, ::mlir::spirv::TosaNegateOp, ::mlir::spirv::TosaPadOp, ::mlir::spirv::TosaPowOp, ::mlir::spirv::TosaRFFT2DOp, ::mlir::spirv::TosaReciprocalOp, ::mlir::spirv::TosaReduceAllOp, ::mlir::spirv::TosaReduceAnyOp, ::mlir::spirv::TosaReduceMaxOp, ::mlir::spirv::TosaReduceMinOp, ::mlir::spirv::TosaReduceProductOp, ::mlir::spirv::TosaReduceSumOp, ::mlir::spirv::TosaRescaleOp, ::mlir::spirv::TosaReshapeOp, ::mlir::spirv::TosaResizeOp, ::mlir::spirv::TosaReverseOp, ::mlir::spirv::TosaRsqrtOp, ::mlir::spirv::TosaScatterOp, ::mlir::spirv::TosaSelectOp, ::mlir::spirv::TosaSigmoidOp, ::mlir::spirv::TosaSinOp, ::mlir::spirv::TosaSliceOp, ::mlir::spirv::TosaSubOp, ::mlir::spirv::TosaTableOp, ::mlir::spirv::TosaTanhOp, ::mlir::spirv::TosaTileOp, ::mlir::spirv::TosaTransposeConv2DOp, ::mlir::spirv::TosaTransposeOp, ::mlir::spirv::TransposeOp, ::mlir::spirv::UConvertOp, ::mlir::spirv::UDivOp, ::mlir::spirv::UDotAccSatOp, ::mlir::spirv::UDotOp, ::mlir::spirv::UGreaterThanEqualOp, ::mlir::spirv::UGreaterThanOp, ::mlir::spirv::ULessThanEqualOp, ::mlir::spirv::ULessThanOp, ::mlir::spirv::UModOp, ::mlir::spirv::UMulExtendedOp, ::mlir::spirv::UndefOp, ::mlir::spirv::UnorderedOp, ::mlir::spirv::UnreachableOp, ::mlir::spirv::VariableOp, ::mlir::spirv::VectorExtractDynamicOp, ::mlir::spirv::VectorInsertDynamicOp, ::mlir::spirv::VectorShuffleOp, ::mlir::spirv::VectorTimesMatrixOp, ::mlir::spirv::VectorTimesScalarOp, ::mlir::spirv::YieldOp #endif // GET_OP_LIST #ifdef GET_OP_CLASSES #undef GET_OP_CLASSES //===----------------------------------------------------------------------===// // Local Utility Method Definitions //===----------------------------------------------------------------------===// static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps1( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V pointer type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps2( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be variadic of 8/16/32/64-bit integer, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps3( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 fixed-length vector of bool values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps4( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((type.isSignlessInteger(1)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be bool, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps5( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 8/16/32/64-bit integer, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps6( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((type.isF16())) || ((type.isF32())) || ((type.isF64()))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 8/16/32/64-bit integer or 16/32/64-bit float, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps7( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps8( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((type.isF16())) || ((type.isF32())) || ((type.isF64())))) || ((type.isSignlessInteger(1)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16)))))) || ((::llvm::isa<::mlir::spirv::PointerType>(type)))) || ((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 8/16/32/64-bit integer or 16/32/64-bit float or bool or vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or any SPIR-V pointer type or any SPIR-V cooperative matrix type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps9( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((::llvm::isa<::mlir::NoneType>(type))) || ((type.isSignlessInteger(1))) || (((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || ((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || ((::llvm::isa<::mlir::BFloat16Type>(type))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(type))) || ((::llvm::isa<::mlir::Float8E5M2Type>(type)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))) || ((::llvm::isa<::mlir::spirv::PointerType>(type))) || ((::llvm::isa<::mlir::spirv::ArrayType>(type))) || ((::llvm::isa<::mlir::spirv::RuntimeArrayType>(type))) || ((::llvm::isa<::mlir::spirv::StructType>(type))) || ((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type))) || ((::llvm::isa<::mlir::spirv::MatrixType>(type))) || ((::llvm::isa<::mlir::spirv::SampledImageType>(type))) || ((::llvm::isa<::mlir::spirv::SamplerType>(type))) || ((::llvm::isa<::mlir::spirv::ImageType>(type))) || ((::llvm::isa<::mlir::spirv::TensorArmType>(type))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 variadic of void or bool or 8/16/32/64-bit integer or 16/32/64-bit float or BFloat16 or Float8E4M3 or Float8E5M2 or vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or any SPIR-V pointer type or any SPIR-V array type or any SPIR-V runtime array type or any SPIR-V struct type or any SPIR-V cooperative matrix type or any SPIR-V matrix type or any SPIR-V sampled image type or any SPIR-V sampler type or any SPIR-V image type or any SPIR-V tensorArm type or vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or vector of BFloat16 or Float8E4M3 or Float8E5M2 values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps10( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps11( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))) || ((::llvm::isa<::mlir::spirv::ArrayType>(type))) || ((::llvm::isa<::mlir::spirv::RuntimeArrayType>(type))) || ((::llvm::isa<::mlir::spirv::StructType>(type))) || ((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type))) || ((::llvm::isa<::mlir::spirv::MatrixType>(type))) || ((::llvm::isa<::mlir::spirv::TensorArmType>(type))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or vector of BFloat16 or Float8E4M3 or Float8E5M2 values of length 2/3/4/8/16 of ranks 1 or any SPIR-V array type or any SPIR-V runtime array type or any SPIR-V struct type or any SPIR-V cooperative matrix type or any SPIR-V matrix type or any SPIR-V tensorArm type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps12( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((::llvm::isa<::mlir::NoneType>(type))) || ((type.isSignlessInteger(1))) || (((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || ((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || ((::llvm::isa<::mlir::BFloat16Type>(type))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(type))) || ((::llvm::isa<::mlir::Float8E5M2Type>(type)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))) || ((::llvm::isa<::mlir::spirv::PointerType>(type))) || ((::llvm::isa<::mlir::spirv::ArrayType>(type))) || ((::llvm::isa<::mlir::spirv::RuntimeArrayType>(type))) || ((::llvm::isa<::mlir::spirv::StructType>(type))) || ((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type))) || ((::llvm::isa<::mlir::spirv::MatrixType>(type))) || ((::llvm::isa<::mlir::spirv::SampledImageType>(type))) || ((::llvm::isa<::mlir::spirv::SamplerType>(type))) || ((::llvm::isa<::mlir::spirv::ImageType>(type))) || ((::llvm::isa<::mlir::spirv::TensorArmType>(type))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 void or bool or 8/16/32/64-bit integer or 16/32/64-bit float or BFloat16 or Float8E4M3 or Float8E5M2 or vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or any SPIR-V pointer type or any SPIR-V array type or any SPIR-V runtime array type or any SPIR-V struct type or any SPIR-V cooperative matrix type or any SPIR-V matrix type or any SPIR-V sampled image type or any SPIR-V sampler type or any SPIR-V image type or any SPIR-V tensorArm type or vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or vector of BFloat16 or Float8E4M3 or Float8E5M2 values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps13( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || ((::llvm::isa<::mlir::BFloat16Type>(type))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(type))) || ((::llvm::isa<::mlir::Float8E5M2Type>(type)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64()))) || ((::llvm::isa<::mlir::BFloat16Type>(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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))) || (((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type))) && ((((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF32())) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF64()))) || ((::llvm::isa<::mlir::BFloat16Type>(::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType()))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType()))) || ((::llvm::isa<::mlir::Float8E5M2Type>(::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType()))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 16/32/64-bit float or BFloat16 or Float8E4M3 or Float8E5M2 or fixed-length vector of 16/32/64-bit float or BFloat16 or Float8E4M3 or Float8E5M2 values of length 2/3/4/8/16 of ranks 1 or Cooperative Matrix of 16/32/64-bit float or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps14( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))) || (((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type))) && (((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isInteger(8))) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isInteger(16))) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isInteger(32))) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isInteger(64))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1 or Cooperative Matrix of 8/16/32/64-bit integer values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps15( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or fixed-length vector of BFloat16 values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps16( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || ((::llvm::isa<::mlir::BFloat16Type>(type))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 16/32/64-bit float or BFloat16, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps17( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((type.isF16())) || ((type.isF32())) || ((type.isF64())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 16/32/64-bit float, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps18( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((type.isSignlessInteger(32))) || ((type.isUnsignedInteger(32))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 32-bit signless/unsigned integer, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps19( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(!((::llvm::isa<::mlir::TokenType>(type))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be variadic of any non-token type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps20( ::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_SPIRVOps21( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))) || (((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type))) && (((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF32())) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF64())))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or Cooperative Matrix of 16/32/64-bit float values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps22( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((type.isSignlessInteger(1))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 bool or fixed-length vector of bool values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps23( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((type.isF16())) || ((type.isF32()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 16/32-bit float or fixed-length vector of 16/32-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps24( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((type.isSignlessInteger(32))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be Int32 or fixed-length vector of Int32 values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps25( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::StructType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V struct type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps26( ::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))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be vector of Float32 values of length 2, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps27( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((type.isSignlessInteger(32)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be Int32, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps28( ::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))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be vector of Float32 values of length 4, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps29( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::TensorArmType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V tensorArm type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps30( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::TensorArmType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be variadic of any SPIR-V tensorArm type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps31( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((type.isF16())) || ((type.isF32())) || ((type.isF64())))) || ((type.isSignlessInteger(1)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 8/16/32/64-bit integer or 16/32/64-bit float or bool or vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps32( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(32))) || ((elementType.isUnsignedInteger(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))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be vector of 32-bit signless/unsigned integer values of length 4 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps33( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((type.isSignlessInteger(8))) || ((type.isUnsignedInteger(8)))) || (((type.isSignlessInteger(16))) || ((type.isUnsignedInteger(16)))) || (((type.isSignlessInteger(32))) || ((type.isUnsignedInteger(32)))) || (((type.isSignlessInteger(64))) || ((type.isUnsignedInteger(64)))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 8/16/32/64-bit signless/unsigned integer, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps34( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (((elementType.isSignlessInteger(8))) || ((elementType.isUnsignedInteger(8)))) || (((elementType.isSignlessInteger(16))) || ((elementType.isUnsignedInteger(16)))) || (((elementType.isSignlessInteger(32))) || ((elementType.isUnsignedInteger(32)))) || (((elementType.isSignlessInteger(64))) || ((elementType.isUnsignedInteger(64)))); }(::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 vector of 8/16/32/64-bit signless/unsigned integer values of length 4 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps35( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((type.isSignlessInteger(16))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 Int16 or fixed-length vector of Int16 values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps36( ::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))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 Float32 or fixed-length vector of Float32 values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps37( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::spirv::PointerType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16)))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be fixed-length vector of any SPIR-V pointer type values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps38( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64()))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16)))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be fixed-length vector of 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps39( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::SampledImageType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V sampled image type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps40( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((type.isF32()))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be Float32, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps41( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::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))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((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 vector of 8/16/32/64-bit integer values of length 4 of ranks 1 or vector of 16/32/64-bit float values of length 4 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps42( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::ImageType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V image type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps43( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((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)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::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 vector of 16/32/64-bit float values of length 4 of ranks 1 or vector of 8/16/32/64-bit integer values of length 4 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps44( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16)))))) || ((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16)))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps45( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V cooperative matrix type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps46( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || ((type.isSignlessInteger(1)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || ((elementType.isSignlessInteger(1))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 8/16/32/64-bit integer or bool or fixed-length vector of 8/16/32/64-bit integer or bool values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps47( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isInteger(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))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be vector of 32-bit integer values of length 4 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps48( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::MatrixType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V matrix type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps49( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((::llvm::isa<::mlir::spirv::MatrixType>(type))) || (((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(type))) && (((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF32())) || ((::llvm::cast<::mlir::spirv::CooperativeMatrixType>(type).getElementType().isF64())))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V matrix type or Cooperative Matrix of 16/32/64-bit float values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps50( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((::llvm::isa<::mlir::spirv::MatrixType>(type))) && (((::llvm::cast<::mlir::spirv::MatrixType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::spirv::MatrixType>(type).getElementType().isF32())) || ((::llvm::cast<::mlir::spirv::MatrixType>(type).getElementType().isF64()))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be Matrix of 16/32/64-bit float values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps51( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16)))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps52( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::NamedBarrierType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V named barrier type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps53( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((::llvm::isa<::mlir::spirv::SamplerType>(type)))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be any SPIR-V sampler type, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps54( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((type.isF16())) || ((type.isF32())) || ((type.isF64())))) || ((type.isSignlessInteger(1)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))) || ((::llvm::isa<::mlir::spirv::PointerType>(type))) || ((::llvm::isa<::mlir::spirv::MatrixType>(type))) || ((::llvm::isa<::mlir::spirv::ArrayType>(type))) || ((::llvm::isa<::mlir::spirv::StructType>(type))) || ((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || ((::llvm::isa<::mlir::BFloat16Type>(type))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(type))) || ((::llvm::isa<::mlir::Float8E5M2Type>(type)))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 8/16/32/64-bit integer or 16/32/64-bit float or bool or vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or any SPIR-V pointer type or any SPIR-V matrix type or any SPIR-V array type or any SPIR-V struct type or 16/32/64-bit float or BFloat16 or Float8E4M3 or Float8E5M2 or vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1 or vector of BFloat16 or Float8E4M3 or Float8E5M2 values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps55( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(32))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of Int32 or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps56( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of 8/16-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps57( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5))))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D tensorArm of Int32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps58( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of 8/16/32-bit integer values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps59( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 4D tensorArm of 8/16-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps60( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 1))) && ((((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(8))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(16)))) || (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))) || ((::llvm::isa<::mlir::Float8E5M2Type>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 1 of 8/16-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps61( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of bool or 8/16/32-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps62( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32)))) || ((elementType.isSignlessInteger(1))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of 8/16/32-bit integer or bool or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps63( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps64( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of 8/16-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps65( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of Int32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps66( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be variadic of 1D/2D/3D/4D/5D/6D tensorArm of bool or 8/16/32-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps67( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 4D tensorArm of Int8 or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps68( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D tensorArm of 32/64-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps69( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 1))) && (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isSignlessInteger(8))) || (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))) || ((::llvm::isa<::mlir::Float8E5M2Type>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 1 of Int8 or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps70( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 4D tensorArm of 32/64-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps71( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 5D tensorArm of 8/16-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps72( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 5D tensorArm of Int8 or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps73( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 5D tensorArm of 32/64-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps74( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of bool values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps75( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 3D tensorArm of Float32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps76( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::StructType>(type))) && ((::llvm::cast<::mlir::spirv::StructType>(type).getNumElements() == 2))) && (::llvm::all_of(::llvm::cast<::mlir::spirv::StructType>(type).getElementTypes(), [](::mlir::Type t) { return t && ((((::llvm::isa<::mlir::spirv::TensorArmType>(t))) && (((::llvm::cast<::mlir::ShapedType>(t).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(t).getRank() == 3)))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(t).getElementType()))); })))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be Struct with any combination of 3D tensorArm of Float32 values values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps77( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 3D tensorArm of 8/16/32-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps78( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 2D tensorArm of Int32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps79( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 3D tensorArm of 8/16-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps80( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || ((elementType.isF16())) || ((elementType.isF32())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 3D tensorArm of 32/64-bit integer or Float16 or Float32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps81( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of 8/16/32-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps82( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isSignlessInteger(8))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 1 of Int8 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps83( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 1))) && ((((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(8))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(16))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(32)))) || (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 1 of 8/16/32-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps84( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 2)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 4)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 6)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 8)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 10)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 12)))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isSignlessInteger(32))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 2/4/6/8/10/12 of Int32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps85( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 1))) && (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isSignlessInteger(1))) || (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(8))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(16))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(32)))) || (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))) || ((::llvm::isa<::mlir::Float8E5M2Type>(::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType()))))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 1 of bool or 8/16/32-bit integer or Float16 or Float32 or BFloat16 or Float8E4M3 or Float8E5M2 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps86( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of 8/16/32/64-bit integer values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps87( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(16))) || ((elementType.isInteger(32))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D tensorArm of 16/32-bit integer values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps88( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D tensorArm of Int8 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps89( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 1))) && (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(8))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(16))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(32))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(64)))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 1 of 8/16/32/64-bit integer values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps90( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 1))) && (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(8))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(16))) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isInteger(32)))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 1 of 8/16/32-bit integer values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps91( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && (((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 1)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 2)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 3)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 4)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 5)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 6)))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isSignlessInteger(32))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 1/2/3/4/5/6 of Int32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps92( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 4D tensorArm of 8/16-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps93( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 4))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isSignlessInteger(32))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 4 of Int32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps94( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getShape()[0] == 2))) && ((::llvm::cast<::mlir::spirv::TensorArmType>(type).getElementType().isSignlessInteger(32))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be rank 1 tensorArm of length 2 of Int32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps95( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)))) && ([](::mlir::Type elementType) { return (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 4D tensorArm of 8/16/32/64-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps96( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of bool or 8/16/32-bit integer or Float16 or Float32 or BFloat16 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps97( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of 8/16-bit integer values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps98( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D tensorArm of 8/16-bit integer values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps99( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!((((::llvm::isa<::mlir::spirv::TensorArmType>(type))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && (((::llvm::cast<::mlir::ShapedType>(type).getRank() == 1)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 2)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 3)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 4)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 5)) || ((::llvm::cast<::mlir::ShapedType>(type).getRank() == 6))))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(32))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 1D/2D/3D/4D/5D/6D tensorArm of Int8 or Int32 values, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps100( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::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 bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps101( ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, unsigned valueIndex) { if (!(((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((type.isF16())) || ((type.isF32())) || ((type.isF64())))) || ((type.isSignlessInteger(1))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be 8/16/32/64-bit integer or 16/32/64-bit float or bool, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_type_constraint_SPIRVOps102( ::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())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)))))) { return op->emitOpError(valueKind) << " #" << valueIndex << " must be vector of 16/32/64-bit float values of length 2/3/4, but got " << type; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps1( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: flat symbol reference attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps1( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps1(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps2( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::ScopeAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V Scope"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps2( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps2(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps3( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V MemorySemantics"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps3( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps3(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps4( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit integer array attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps4( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps4(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps5( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((true))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: any attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps5( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps5(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps6( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::MemoryAccessAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V MemoryAccess"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps6( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps6(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps7( ::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().isStrictlyPositive())) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isPowerOf2()))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps7( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps7(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps8( ::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_SPIRVOps8( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps8(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps9( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: string attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps9( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps9(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps10( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: symbol reference attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps10( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps10(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps11( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::ExecutionModelAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V ExecutionModel"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps11( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps11(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps12( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: symbol ref array attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps12( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps12(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps13( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::ExecutionModeAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V ExecutionMode"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps13( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps13(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps14( ::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_SPIRVOps14( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps14(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps15( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: type attribute of function type"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps15( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps15(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps16( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: Array of dictionary attributes"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps16( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps16(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps17( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::FunctionControlAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V FunctionControl"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps17( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps17(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps18( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::LinkageAttributesAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: "; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps18( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps18(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps19( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::GraphType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::GraphType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: type attribute of graph type"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps19( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps19(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps20( ::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_SPIRVOps20( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps20(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps21( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V GroupOperation"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps21( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps21(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps22( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::QuadSwapDirectionAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: Swap direction of a GroupNonUniformQuadSwap"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps22( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps22(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps23( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::ImageOperandsAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V ImageOperands"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps23( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps23(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps24( ::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()))) && ((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: type attribute of any SPIR-V cooperative matrix type"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps24( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps24(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps25( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::CooperativeMatrixLayoutKHRAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V Cooperative Matrix Layout (KHR)"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps25( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps25(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps26( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::CooperativeMatrixOperandsKHRAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V Cooperative Matrix Operands (KHR)"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps26( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps26(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps27( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::LoopControlAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V LoopControl"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps27( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps27(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps28( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::AddressingModelAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V AddressingModel"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps28( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps28(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps29( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::MemoryModelAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V MemoryModel"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps29( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps29(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps30( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::VerCapExtAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: version-capability-extension attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps30( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps30(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps31( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::PackedVectorFormatAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V PackedVectorFormat"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps31( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps31(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps32( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::SelectionControlAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V SelectionControl"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps32( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps32(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps33( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::TypedAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: TypedAttr instance"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps33( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps33(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps34( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((true)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: integer elements attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps34( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps34(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps35( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: i32 dense array attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps35( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps35(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps36( ::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() <= 5)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps36( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps36(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps37( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::TosaExtNaNPropagationModeTypeAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: Tosa Ext NaN Propoagation Mode Type"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps37( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps37(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps38( ::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_SPIRVOps38( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps38(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps39( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(attr).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps39( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps39(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps40( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef({4})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(attr).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 0; }))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit signless int elements attribute of shape [4] Attr with type = spirv::TensorArmType all values must be >= 0"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps40( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps40(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps41( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::TosaExtAccTypeAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: Tosa Ext Acculumator Type"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps41( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps41(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps42( ::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(8)))) || (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(16)))) || (((::llvm::isa<::mlir::FloatAttr>(attr))) && ((::llvm::cast<::mlir::FloatAttr>(attr).getType().isF16()))) || (((::llvm::isa<::mlir::FloatAttr>(attr))) && ((::llvm::cast<::mlir::FloatAttr>(attr).getType().isF32()))) || (((::llvm::isa<::mlir::FloatAttr>(attr))) && ((::llvm::cast<::mlir::FloatAttr>(attr).getType().isBF16()))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 8-bit signless integer attribute or 16-bit signless integer attribute or 16-bit float attribute or 32-bit float attribute or 16-bit bfloat attribute"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps42( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps42(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps43( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef({6})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(attr).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 0; }))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit signless int elements attribute of shape [6] Attr with type = spirv::TensorArmType all values must be >= 0"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps43( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps43(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps44( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef({3})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(attr).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit signless int elements attribute of shape [3] Attr with type = spirv::TensorArmType all values must be >= 1"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps44( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps44(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps45( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::TosaExtRoundingModeTypeAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: Tosa Ext Rounding Mode Type"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps45( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps45(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps46( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::TosaExtResizeModeTypeAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: Tosa Ext Resize Mode Type"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps46( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps46(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps47( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef({4})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit signless int elements attribute of shape [4] Attr with type = spirv::TensorArmType"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps47( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps47(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps48( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()))) && (((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()).getShape().size() == 1 )) && (((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()).getShape()[0] == 1)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()).getShape()[0] == 2)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()).getShape()[0] == 3)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()).getShape()[0] == 4)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()).getShape()[0] == 5)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(attr).getType()).getShape()[0] == 6)))))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: 32-bit signless integer elements attribute Attr with type = spirv::TensorArmType "; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps48( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps48(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps49( ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { if (attr && !((::llvm::isa<::mlir::spirv::StorageClassAttr>(attr)))) return emitError() << "attribute '" << attrName << "' failed to satisfy constraint: valid SPIR-V StorageClass"; return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SPIRVOps49( ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { return __mlir_ods_local_attr_constraint_SPIRVOps49(attr, attrName, [op]() { return op->emitOpError(); }); } static ::llvm::LogicalResult __mlir_ods_local_region_constraint_SPIRVOps1( ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, unsigned regionIndex) { if (!((true))) { return op->emitOpError("region #") << regionIndex << (regionName.empty() ? " " : " ('" + regionName + "') ") << "failed to verify constraint: any region"; } return ::mlir::success(); } static ::llvm::LogicalResult __mlir_ods_local_region_constraint_SPIRVOps2( ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, unsigned regionIndex) { if (!((::llvm::hasNItems(region, 1)))) { return op->emitOpError("region #") << regionIndex << (regionName.empty() ? " " : " ('" + regionName + "') ") << "failed to verify constraint: region with 1 blocks"; } return ::mlir::success(); } namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AccessChainOp definitions //===----------------------------------------------------------------------===// namespace detail { AccessChainOpGenericAdaptorBase::AccessChainOpGenericAdaptorBase(AccessChainOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair AccessChainOpGenericAdaptorBase::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 AccessChainOpAdaptor::AccessChainOpAdaptor(AccessChainOp op) : AccessChainOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AccessChainOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair AccessChainOp::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 AccessChainOp::getIndicesMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult AccessChainOp::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 AccessChainOp::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 AccessChainOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional AccessChainOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void AccessChainOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void AccessChainOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult AccessChainOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } AccessChainOp AccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value basePtr, ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(basePtr), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AccessChainOp AccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, Value basePtr, ValueRange indices) { return create(builder, builder.getLoc(), std::forward(basePtr), std::forward(indices)); } void AccessChainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type component_ptr, ::mlir::Value base_ptr, ::mlir::ValueRange indices) { odsState.addOperands(base_ptr); odsState.addOperands(indices); odsState.addTypes(component_ptr); } AccessChainOp AccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type component_ptr, ::mlir::Value base_ptr, ::mlir::ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(component_ptr), std::forward(base_ptr), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AccessChainOp AccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type component_ptr, ::mlir::Value base_ptr, ::mlir::ValueRange indices) { return create(builder, builder.getLoc(), std::forward(component_ptr), std::forward(base_ptr), std::forward(indices)); } void AccessChainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::ValueRange indices) { odsState.addOperands(base_ptr); odsState.addOperands(indices); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AccessChainOp AccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(base_ptr), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AccessChainOp AccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::ValueRange indices) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(base_ptr), std::forward(indices)); } void AccessChainOp::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); } AccessChainOp AccessChainOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AccessChainOp AccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AccessChainOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AccessChainOp AccessChainOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AccessChainOp AccessChainOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AccessChainOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps2(*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_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult AccessChainOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult AccessChainOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand base_ptrRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> base_ptrOperands(&base_ptrRawOperand, 1); ::llvm::SMLoc base_ptrOperandsLoc; (void)base_ptrOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; ::llvm::SMLoc indicesOperandsLoc; (void)indicesOperandsLoc; ::mlir::Type base_ptrRawType{}; ::llvm::ArrayRef<::mlir::Type> base_ptrTypes(&base_ptrRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; base_ptrOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(base_ptrRawOperand)) 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::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); base_ptrRawType = type; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseTypeList(indicesTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(base_ptrOperands, base_ptrTypes, base_ptrOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AccessChainOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getBasePtr(); _odsPrinter << "["; _odsPrinter << getIndices(); _odsPrinter << "]"; ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getBasePtr().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getIndices().getTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void AccessChainOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AccessChainOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AddressOfOp definitions //===----------------------------------------------------------------------===// namespace detail { AddressOfOpGenericAdaptorBase::AddressOfOpGenericAdaptorBase(AddressOfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::llvm::StringRef AddressOfOpGenericAdaptorBase::getVariable() { auto attr = getVariableAttr(); return attr.getValue(); } } // namespace detail AddressOfOpAdaptor::AddressOfOpAdaptor(AddressOfOp op) : AddressOfOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AddressOfOpAdaptor::verify(::mlir::Location loc) { auto tblgen_variable = getProperties().variable; (void)tblgen_variable; if (!tblgen_variable) return emitError(loc, "'spirv.mlir.addressof' op requires attribute 'variable'"); if (tblgen_variable && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_variable)))) return emitError(loc, "'spirv.mlir.addressof' op attribute 'variable' failed to satisfy constraint: flat symbol reference attribute"); return ::mlir::success(); } ::llvm::LogicalResult AddressOfOp::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.variable; auto attr = dict.get("variable"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `variable` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AddressOfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.variable; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("variable", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AddressOfOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.variable.getAsOpaquePointer())); } std::optional AddressOfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "variable") return prop.variable; return std::nullopt; } void AddressOfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "variable") { prop.variable = ::llvm::dyn_cast_or_null>(value); return; } } void AddressOfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.variable) attrs.append("variable", prop.variable); } ::llvm::LogicalResult AddressOfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getVariableAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(attr, "variable", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AddressOfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.variable))) return ::mlir::failure(); return ::mlir::success(); } void AddressOfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.variable); } ::llvm::StringRef AddressOfOp::getVariable() { auto attr = getVariableAttr(); return attr.getValue(); } void AddressOfOp::setVariable(::llvm::StringRef attrValue) { getProperties().variable = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, spirv::GlobalVariableOp var) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(var)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, spirv::GlobalVariableOp var) { return create(builder, builder.getLoc(), std::forward(var)); } void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type pointer, ::mlir::FlatSymbolRefAttr variable) { odsState.getOrAddProperties().variable = variable; odsState.addTypes(pointer); } AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type pointer, ::mlir::FlatSymbolRefAttr variable) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(variable)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type pointer, ::mlir::FlatSymbolRefAttr variable) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(variable)); } void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr variable) { odsState.getOrAddProperties().variable = variable; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr variable) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(variable)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr variable) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(variable)); } void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type pointer, ::llvm::StringRef variable) { odsState.getOrAddProperties().variable = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), variable); odsState.addTypes(pointer); } AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type pointer, ::llvm::StringRef variable) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(variable)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type pointer, ::llvm::StringRef variable) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(variable)); } void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef variable) { odsState.getOrAddProperties().variable = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), variable); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef variable) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(variable)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef variable) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(variable)); } void AddressOfOp::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() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } AddressOfOp AddressOfOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AddressOfOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AddressOfOp AddressOfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AddressOfOp AddressOfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AddressOfOp::verifyInvariantsImpl() { auto tblgen_variable = getProperties().variable; (void)tblgen_variable; if (!tblgen_variable) return emitOpError("requires attribute 'variable'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(*this, tblgen_variable, "variable"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult AddressOfOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult AddressOfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::FlatSymbolRefAttr variableAttr; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(variableAttr, parser.getBuilder().getType<::mlir::NoneType>())) { return ::mlir::failure(); } if (variableAttr) result.getOrAddProperties().variable = variableAttr; { 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(); pointerRawType = type; } result.addTypes(pointerTypes); return ::mlir::success(); } void AddressOfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getVariableAttr()); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("variable"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void AddressOfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AddressOfOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AddressOfOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AllOp definitions //===----------------------------------------------------------------------===// namespace detail { AllOpGenericAdaptorBase::AllOpGenericAdaptorBase(AllOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail AllOpAdaptor::AllOpAdaptor(AllOp op) : AllOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AllOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult AllOp::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 AllOp::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 AllOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional AllOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void AllOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void AllOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult AllOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void AllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector) { odsState.addOperands(vector); odsState.addTypes(result); } AllOp AllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AllOp AllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector)); } void AllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector) { odsState.addOperands(vector); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AllOp::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); } AllOp AllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AllOp AllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector) { return create(builder, builder.getLoc(), std::forward(vector)); } void AllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector) { odsState.addOperands(vector); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AllOp AllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AllOp AllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector)); } void AllOp::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); } AllOp AllOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AllOp AllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AllOp::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(AllOp::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)."); } } AllOp AllOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AllOp AllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AllOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AllOp AllOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AllOp AllOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AllOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AllOp::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)."); } } AllOp AllOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AllOp AllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AllOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps3(*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_SPIRVOps4(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult AllOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult AllOp::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 AllOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vectorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(&vectorRawOperand, 1); ::llvm::SMLoc vectorOperandsLoc; (void)vectorOperandsLoc; ::mlir::Type vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> vectorTypes(&vectorRawType, 1); vectorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vectorRawOperand)) 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(); vectorRawType = type; } ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); result.addTypes(odsBuildableType0); if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AllOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void AllOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AllOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AnyOp definitions //===----------------------------------------------------------------------===// namespace detail { AnyOpGenericAdaptorBase::AnyOpGenericAdaptorBase(AnyOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail AnyOpAdaptor::AnyOpAdaptor(AnyOp op) : AnyOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AnyOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult AnyOp::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 AnyOp::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 AnyOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional AnyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void AnyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void AnyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult AnyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void AnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector) { odsState.addOperands(vector); odsState.addTypes(result); } AnyOp AnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AnyOp AnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector)); } void AnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector) { odsState.addOperands(vector); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AnyOp::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); } AnyOp AnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AnyOp AnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector) { return create(builder, builder.getLoc(), std::forward(vector)); } void AnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector) { odsState.addOperands(vector); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AnyOp AnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AnyOp AnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector)); } void AnyOp::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); } AnyOp AnyOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AnyOp AnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AnyOp::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(AnyOp::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)."); } } AnyOp AnyOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AnyOp AnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AnyOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AnyOp AnyOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AnyOp AnyOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AnyOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AnyOp::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)."); } } AnyOp AnyOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AnyOp AnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AnyOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps3(*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_SPIRVOps4(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult AnyOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult AnyOp::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 AnyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vectorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(&vectorRawOperand, 1); ::llvm::SMLoc vectorOperandsLoc; (void)vectorOperandsLoc; ::mlir::Type vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> vectorTypes(&vectorRawType, 1); vectorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vectorRawOperand)) 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(); vectorRawType = type; } ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); result.addTypes(odsBuildableType0); if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AnyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void AnyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AnyOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicAndOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicAndOpGenericAdaptorBase::AtomicAndOpGenericAdaptorBase(AtomicAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicAndOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicAndOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicAndOpAdaptor::AtomicAndOpAdaptor(AtomicAndOp op) : AtomicAndOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicAndOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicAnd' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicAnd' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicAnd' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicAnd' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicAndOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicAndOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicAndOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicAndOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicAndOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicAndOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicAndOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicAndOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicAndOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicAndOp AtomicAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicAndOp::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); } AtomicAndOp AtomicAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicAndOp AtomicAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicAndOp AtomicAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicAndOp::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); } AtomicAndOp AtomicAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicAndOp AtomicAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicAndOp::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(); ::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."); } } AtomicAndOp AtomicAndOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicAndOp::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(); ::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(AtomicAndOp::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)."); } } AtomicAndOp AtomicAndOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicAndOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicAndOp AtomicAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicAndOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicAndOp::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)."); } } AtomicAndOp AtomicAndOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicAndOp AtomicAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicAndOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicAndOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicAndOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicAndOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicAndOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicCompareExchangeOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicCompareExchangeOpGenericAdaptorBase::AtomicCompareExchangeOpGenericAdaptorBase(AtomicCompareExchangeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicCompareExchangeOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicCompareExchangeOpGenericAdaptorBase::getEqualSemantics() { auto attr = getEqualSemanticsAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicCompareExchangeOpGenericAdaptorBase::getUnequalSemantics() { auto attr = getUnequalSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicCompareExchangeOpAdaptor::AtomicCompareExchangeOpAdaptor(AtomicCompareExchangeOp op) : AtomicCompareExchangeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicCompareExchangeOpAdaptor::verify(::mlir::Location loc) { auto tblgen_equal_semantics = getProperties().equal_semantics; (void)tblgen_equal_semantics; if (!tblgen_equal_semantics) return emitError(loc, "'spirv.AtomicCompareExchange' op requires attribute 'equal_semantics'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicCompareExchange' op requires attribute 'memory_scope'"); auto tblgen_unequal_semantics = getProperties().unequal_semantics; (void)tblgen_unequal_semantics; if (!tblgen_unequal_semantics) return emitError(loc, "'spirv.AtomicCompareExchange' op requires attribute 'unequal_semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicCompareExchange' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_equal_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_equal_semantics)))) return emitError(loc, "'spirv.AtomicCompareExchange' op attribute 'equal_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); if (tblgen_unequal_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_unequal_semantics)))) return emitError(loc, "'spirv.AtomicCompareExchange' op attribute 'unequal_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicCompareExchangeOp::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.equal_semantics; auto attr = dict.get("equal_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `equal_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.unequal_semantics; auto attr = dict.get("unequal_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `unequal_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicCompareExchangeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.equal_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("equal_semantics", propStorage)); } { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.unequal_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("unequal_semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicCompareExchangeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.equal_semantics.getAsOpaquePointer()), llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.unequal_semantics.getAsOpaquePointer())); } std::optional AtomicCompareExchangeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "equal_semantics") return prop.equal_semantics; if (name == "memory_scope") return prop.memory_scope; if (name == "unequal_semantics") return prop.unequal_semantics; return std::nullopt; } void AtomicCompareExchangeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "equal_semantics") { prop.equal_semantics = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "unequal_semantics") { prop.unequal_semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicCompareExchangeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.equal_semantics) attrs.append("equal_semantics", prop.equal_semantics); if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.unequal_semantics) attrs.append("unequal_semantics", prop.unequal_semantics); } ::llvm::LogicalResult AtomicCompareExchangeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getEqualSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "equal_semantics", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getUnequalSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "unequal_semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicCompareExchangeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.equal_semantics))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.unequal_semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicCompareExchangeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.equal_semantics); writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.unequal_semantics); } ::mlir::spirv::Scope AtomicCompareExchangeOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicCompareExchangeOp::getEqualSemantics() { auto attr = getEqualSemanticsAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicCompareExchangeOp::getUnequalSemantics() { auto attr = getUnequalSemanticsAttr(); return attr.getValue(); } void AtomicCompareExchangeOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicCompareExchangeOp::setEqualSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().equal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicCompareExchangeOp::setUnequalSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().unequal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicCompareExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().equal_semantics = equal_semantics; odsState.getOrAddProperties().unequal_semantics = unequal_semantics; odsState.addTypes(result); } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().equal_semantics = equal_semantics; odsState.getOrAddProperties().unequal_semantics = unequal_semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicCompareExchangeOp::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); } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().equal_semantics = equal_semantics; odsState.getOrAddProperties().unequal_semantics = unequal_semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().equal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), equal_semantics); odsState.getOrAddProperties().unequal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), unequal_semantics); odsState.addTypes(result); } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().equal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), equal_semantics); odsState.getOrAddProperties().unequal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), unequal_semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicCompareExchangeOp::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); } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().equal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), equal_semantics); odsState.getOrAddProperties().unequal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), unequal_semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeOp::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(); ::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."); } } AtomicCompareExchangeOp AtomicCompareExchangeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicCompareExchangeOp::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(); ::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(AtomicCompareExchangeOp::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)."); } } AtomicCompareExchangeOp AtomicCompareExchangeOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicCompareExchangeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicCompareExchangeOp AtomicCompareExchangeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicCompareExchangeOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicCompareExchangeOp::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)."); } } AtomicCompareExchangeOp AtomicCompareExchangeOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeOp AtomicCompareExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicCompareExchangeOp::verifyInvariantsImpl() { auto tblgen_equal_semantics = getProperties().equal_semantics; (void)tblgen_equal_semantics; if (!tblgen_equal_semantics) return emitOpError("requires attribute 'equal_semantics'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_unequal_semantics = getProperties().unequal_semantics; (void)tblgen_unequal_semantics; if (!tblgen_unequal_semantics) return emitOpError("requires attribute 'unequal_semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_equal_semantics, "equal_semantics"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_unequal_semantics, "unequal_semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(2).begin()).getType())))) return emitOpError("failed to verify that `comparator` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicCompareExchangeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult AtomicCompareExchangeOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicCompareExchangeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr equal_semanticsAttr; ::mlir::spirv::MemorySemanticsAttr unequal_semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(equal_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (equal_semanticsAttr) result.getOrAddProperties().equal_semantics = equal_semanticsAttr; if (parser.parseCustomAttributeWithFallback(unequal_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (unequal_semanticsAttr) result.getOrAddProperties().unequal_semantics = unequal_semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType()), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicCompareExchangeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getEqualSemanticsAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getUnequalSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("equal_semantics"); elidedAttrs.push_back("unequal_semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicCompareExchangeOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicCompareExchangeOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicCompareExchangeWeakOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicCompareExchangeWeakOpGenericAdaptorBase::AtomicCompareExchangeWeakOpGenericAdaptorBase(AtomicCompareExchangeWeakOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicCompareExchangeWeakOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicCompareExchangeWeakOpGenericAdaptorBase::getEqualSemantics() { auto attr = getEqualSemanticsAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicCompareExchangeWeakOpGenericAdaptorBase::getUnequalSemantics() { auto attr = getUnequalSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicCompareExchangeWeakOpAdaptor::AtomicCompareExchangeWeakOpAdaptor(AtomicCompareExchangeWeakOp op) : AtomicCompareExchangeWeakOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicCompareExchangeWeakOpAdaptor::verify(::mlir::Location loc) { auto tblgen_equal_semantics = getProperties().equal_semantics; (void)tblgen_equal_semantics; if (!tblgen_equal_semantics) return emitError(loc, "'spirv.AtomicCompareExchangeWeak' op requires attribute 'equal_semantics'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicCompareExchangeWeak' op requires attribute 'memory_scope'"); auto tblgen_unequal_semantics = getProperties().unequal_semantics; (void)tblgen_unequal_semantics; if (!tblgen_unequal_semantics) return emitError(loc, "'spirv.AtomicCompareExchangeWeak' op requires attribute 'unequal_semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicCompareExchangeWeak' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_equal_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_equal_semantics)))) return emitError(loc, "'spirv.AtomicCompareExchangeWeak' op attribute 'equal_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); if (tblgen_unequal_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_unequal_semantics)))) return emitError(loc, "'spirv.AtomicCompareExchangeWeak' op attribute 'unequal_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicCompareExchangeWeakOp::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.equal_semantics; auto attr = dict.get("equal_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `equal_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.unequal_semantics; auto attr = dict.get("unequal_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `unequal_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicCompareExchangeWeakOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.equal_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("equal_semantics", propStorage)); } { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.unequal_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("unequal_semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicCompareExchangeWeakOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.equal_semantics.getAsOpaquePointer()), llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.unequal_semantics.getAsOpaquePointer())); } std::optional AtomicCompareExchangeWeakOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "equal_semantics") return prop.equal_semantics; if (name == "memory_scope") return prop.memory_scope; if (name == "unequal_semantics") return prop.unequal_semantics; return std::nullopt; } void AtomicCompareExchangeWeakOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "equal_semantics") { prop.equal_semantics = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "unequal_semantics") { prop.unequal_semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicCompareExchangeWeakOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.equal_semantics) attrs.append("equal_semantics", prop.equal_semantics); if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.unequal_semantics) attrs.append("unequal_semantics", prop.unequal_semantics); } ::llvm::LogicalResult AtomicCompareExchangeWeakOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getEqualSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "equal_semantics", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getUnequalSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "unequal_semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicCompareExchangeWeakOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.equal_semantics))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.unequal_semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicCompareExchangeWeakOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.equal_semantics); writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.unequal_semantics); } ::mlir::spirv::Scope AtomicCompareExchangeWeakOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicCompareExchangeWeakOp::getEqualSemantics() { auto attr = getEqualSemanticsAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicCompareExchangeWeakOp::getUnequalSemantics() { auto attr = getUnequalSemanticsAttr(); return attr.getValue(); } void AtomicCompareExchangeWeakOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicCompareExchangeWeakOp::setEqualSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().equal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicCompareExchangeWeakOp::setUnequalSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().unequal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicCompareExchangeWeakOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().equal_semantics = equal_semantics; odsState.getOrAddProperties().unequal_semantics = unequal_semantics; odsState.addTypes(result); } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeWeakOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().equal_semantics = equal_semantics; odsState.getOrAddProperties().unequal_semantics = unequal_semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicCompareExchangeWeakOp::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); } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeWeakOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().equal_semantics = equal_semantics; odsState.getOrAddProperties().unequal_semantics = unequal_semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr equal_semantics, ::mlir::spirv::MemorySemanticsAttr unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeWeakOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().equal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), equal_semantics); odsState.getOrAddProperties().unequal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), unequal_semantics); odsState.addTypes(result); } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeWeakOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().equal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), equal_semantics); odsState.getOrAddProperties().unequal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), unequal_semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicCompareExchangeWeakOp::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); } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeWeakOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.addOperands(comparator); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().equal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), equal_semantics); odsState.getOrAddProperties().unequal_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), unequal_semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics equal_semantics, ::mlir::spirv::MemorySemantics unequal_semantics, ::mlir::Value value, ::mlir::Value comparator) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(equal_semantics), std::forward(unequal_semantics), std::forward(value), std::forward(comparator)); } void AtomicCompareExchangeWeakOp::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(); ::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."); } } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicCompareExchangeWeakOp::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(); ::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(AtomicCompareExchangeWeakOp::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)."); } } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicCompareExchangeWeakOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicCompareExchangeWeakOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicCompareExchangeWeakOp::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)."); } } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicCompareExchangeWeakOp AtomicCompareExchangeWeakOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicCompareExchangeWeakOp::verifyInvariantsImpl() { auto tblgen_equal_semantics = getProperties().equal_semantics; (void)tblgen_equal_semantics; if (!tblgen_equal_semantics) return emitOpError("requires attribute 'equal_semantics'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_unequal_semantics = getProperties().unequal_semantics; (void)tblgen_unequal_semantics; if (!tblgen_unequal_semantics) return emitOpError("requires attribute 'unequal_semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_equal_semantics, "equal_semantics"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_unequal_semantics, "unequal_semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(2).begin()).getType())))) return emitOpError("failed to verify that `comparator` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicCompareExchangeWeakOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult AtomicCompareExchangeWeakOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicCompareExchangeWeakOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr equal_semanticsAttr; ::mlir::spirv::MemorySemanticsAttr unequal_semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(equal_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (equal_semanticsAttr) result.getOrAddProperties().equal_semantics = equal_semanticsAttr; if (parser.parseCustomAttributeWithFallback(unequal_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (unequal_semanticsAttr) result.getOrAddProperties().unequal_semantics = unequal_semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType()), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicCompareExchangeWeakOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getEqualSemanticsAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getUnequalSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("equal_semantics"); elidedAttrs.push_back("unequal_semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicCompareExchangeWeakOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicCompareExchangeWeakOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicExchangeOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicExchangeOpGenericAdaptorBase::AtomicExchangeOpGenericAdaptorBase(AtomicExchangeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicExchangeOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicExchangeOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicExchangeOpAdaptor::AtomicExchangeOpAdaptor(AtomicExchangeOp op) : AtomicExchangeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicExchangeOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicExchange' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicExchange' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicExchange' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicExchange' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicExchangeOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicExchangeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicExchangeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicExchangeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicExchangeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicExchangeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicExchangeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicExchangeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicExchangeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicExchangeOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicExchangeOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicExchangeOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicExchangeOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicExchangeOp AtomicExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicExchangeOp::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); } AtomicExchangeOp AtomicExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicExchangeOp AtomicExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicExchangeOp AtomicExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicExchangeOp::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); } AtomicExchangeOp AtomicExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicExchangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicExchangeOp AtomicExchangeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicExchangeOp::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(); ::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."); } } AtomicExchangeOp AtomicExchangeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicExchangeOp::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(); ::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(AtomicExchangeOp::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)."); } } AtomicExchangeOp AtomicExchangeOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicExchangeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicExchangeOp AtomicExchangeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicExchangeOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicExchangeOp::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)."); } } AtomicExchangeOp AtomicExchangeOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicExchangeOp AtomicExchangeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicExchangeOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps6(*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_SPIRVOps6(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicExchangeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult AtomicExchangeOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicExchangeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicExchangeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicExchangeOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicExchangeOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicIAddOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicIAddOpGenericAdaptorBase::AtomicIAddOpGenericAdaptorBase(AtomicIAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicIAddOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicIAddOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicIAddOpAdaptor::AtomicIAddOpAdaptor(AtomicIAddOp op) : AtomicIAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicIAddOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicIAdd' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicIAdd' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicIAdd' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicIAdd' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicIAddOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicIAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicIAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicIAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicIAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicIAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicIAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicIAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicIAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicIAddOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicIAddOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicIAddOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicIAddOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicIAddOp AtomicIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIAddOp::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); } AtomicIAddOp AtomicIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicIAddOp AtomicIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicIAddOp AtomicIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIAddOp::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); } AtomicIAddOp AtomicIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicIAddOp AtomicIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicIAddOp::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(); ::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."); } } AtomicIAddOp AtomicIAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicIAddOp::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(); ::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(AtomicIAddOp::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)."); } } AtomicIAddOp AtomicIAddOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicIAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicIAddOp AtomicIAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicIAddOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIAddOp::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)."); } } AtomicIAddOp AtomicIAddOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIAddOp AtomicIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicIAddOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicIAddOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicIAddOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicIAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicIAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicIAddOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicIAddOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicIDecrementOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicIDecrementOpGenericAdaptorBase::AtomicIDecrementOpGenericAdaptorBase(AtomicIDecrementOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicIDecrementOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicIDecrementOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicIDecrementOpAdaptor::AtomicIDecrementOpAdaptor(AtomicIDecrementOp op) : AtomicIDecrementOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicIDecrementOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicIDecrement' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicIDecrement' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicIDecrement' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicIDecrement' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicIDecrementOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicIDecrementOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicIDecrementOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicIDecrementOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicIDecrementOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicIDecrementOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicIDecrementOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicIDecrementOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicIDecrementOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicIDecrementOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicIDecrementOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicIDecrementOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicIDecrementOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicIDecrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIDecrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIDecrementOp::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); } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIDecrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIDecrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIDecrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIDecrementOp::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); } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIDecrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIDecrementOp::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(); ::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."); } } AtomicIDecrementOp AtomicIDecrementOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicIDecrementOp::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(); ::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(AtomicIDecrementOp::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)."); } } AtomicIDecrementOp AtomicIDecrementOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicIDecrementOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicIDecrementOp AtomicIDecrementOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicIDecrementOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIDecrementOp::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)."); } } AtomicIDecrementOp AtomicIDecrementOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIDecrementOp AtomicIDecrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicIDecrementOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicIDecrementOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicIDecrementOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicIDecrementOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, pointerTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicIDecrementOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicIDecrementOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicIDecrementOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicIIncrementOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicIIncrementOpGenericAdaptorBase::AtomicIIncrementOpGenericAdaptorBase(AtomicIIncrementOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicIIncrementOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicIIncrementOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicIIncrementOpAdaptor::AtomicIIncrementOpAdaptor(AtomicIIncrementOp op) : AtomicIIncrementOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicIIncrementOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicIIncrement' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicIIncrement' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicIIncrement' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicIIncrement' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicIIncrementOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicIIncrementOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicIIncrementOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicIIncrementOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicIIncrementOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicIIncrementOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicIIncrementOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicIIncrementOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicIIncrementOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicIIncrementOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicIIncrementOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicIIncrementOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicIIncrementOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicIIncrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIIncrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIIncrementOp::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); } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIIncrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIIncrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIIncrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIIncrementOp::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); } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIIncrementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicIIncrementOp::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(); ::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."); } } AtomicIIncrementOp AtomicIIncrementOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicIIncrementOp::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(); ::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(AtomicIIncrementOp::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)."); } } AtomicIIncrementOp AtomicIIncrementOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicIIncrementOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicIIncrementOp AtomicIIncrementOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicIIncrementOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicIIncrementOp::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)."); } } AtomicIIncrementOp AtomicIIncrementOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicIIncrementOp AtomicIIncrementOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicIIncrementOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicIIncrementOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicIIncrementOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicIIncrementOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, pointerTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicIIncrementOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicIIncrementOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicIIncrementOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicISubOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicISubOpGenericAdaptorBase::AtomicISubOpGenericAdaptorBase(AtomicISubOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicISubOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicISubOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicISubOpAdaptor::AtomicISubOpAdaptor(AtomicISubOp op) : AtomicISubOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicISubOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicISub' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicISub' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicISub' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicISub' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicISubOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicISubOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicISubOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicISubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicISubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicISubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicISubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicISubOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicISubOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicISubOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicISubOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicISubOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicISubOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicISubOp AtomicISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicISubOp::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); } AtomicISubOp AtomicISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicISubOp AtomicISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicISubOp AtomicISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicISubOp::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); } AtomicISubOp AtomicISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicISubOp AtomicISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicISubOp::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(); ::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."); } } AtomicISubOp AtomicISubOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicISubOp::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(); ::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(AtomicISubOp::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)."); } } AtomicISubOp AtomicISubOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicISubOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicISubOp AtomicISubOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicISubOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicISubOp::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)."); } } AtomicISubOp AtomicISubOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicISubOp AtomicISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicISubOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicISubOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicISubOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicISubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicISubOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicISubOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicISubOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicLoadOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicLoadOpGenericAdaptorBase::AtomicLoadOpGenericAdaptorBase(AtomicLoadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicLoadOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicLoadOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicLoadOpAdaptor::AtomicLoadOpAdaptor(AtomicLoadOp op) : AtomicLoadOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicLoadOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicLoad' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicLoad' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicLoad' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicLoad' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicLoadOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicLoadOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicLoadOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicLoadOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicLoadOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicLoadOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicLoadOp AtomicLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicLoadOp::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); } AtomicLoadOp AtomicLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicLoadOp AtomicLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicLoadOp AtomicLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicLoadOp::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); } AtomicLoadOp AtomicLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { odsState.addOperands(pointer); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicLoadOp AtomicLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics)); } void AtomicLoadOp::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(); ::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."); } } AtomicLoadOp AtomicLoadOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicLoadOp::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(); ::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(AtomicLoadOp::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)."); } } AtomicLoadOp AtomicLoadOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicLoadOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicLoadOp AtomicLoadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicLoadOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicLoadOp::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)."); } } AtomicLoadOp AtomicLoadOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicLoadOp AtomicLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicLoadOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps6(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicLoadOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult AtomicLoadOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, pointerTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicLoadOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicLoadOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicOrOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicOrOpGenericAdaptorBase::AtomicOrOpGenericAdaptorBase(AtomicOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicOrOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicOrOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicOrOpAdaptor::AtomicOrOpAdaptor(AtomicOrOp op) : AtomicOrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicOrOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicOr' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicOr' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicOr' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicOr' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicOrOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicOrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicOrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicOrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicOrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicOrOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicOrOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicOrOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicOrOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicOrOp AtomicOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicOrOp::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); } AtomicOrOp AtomicOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicOrOp AtomicOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicOrOp AtomicOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicOrOp::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); } AtomicOrOp AtomicOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicOrOp AtomicOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicOrOp::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(); ::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."); } } AtomicOrOp AtomicOrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicOrOp::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(); ::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(AtomicOrOp::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)."); } } AtomicOrOp AtomicOrOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicOrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicOrOp AtomicOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicOrOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicOrOp::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)."); } } AtomicOrOp AtomicOrOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicOrOp AtomicOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicOrOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicOrOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicOrOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicOrOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicOrOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicSMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicSMaxOpGenericAdaptorBase::AtomicSMaxOpGenericAdaptorBase(AtomicSMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicSMaxOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicSMaxOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicSMaxOpAdaptor::AtomicSMaxOpAdaptor(AtomicSMaxOp op) : AtomicSMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicSMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicSMax' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicSMax' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicSMax' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicSMax' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicSMaxOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicSMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicSMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicSMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicSMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicSMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicSMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicSMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicSMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicSMaxOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicSMaxOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicSMaxOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicSMaxOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicSMaxOp AtomicSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicSMaxOp::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); } AtomicSMaxOp AtomicSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicSMaxOp AtomicSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicSMaxOp AtomicSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicSMaxOp::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); } AtomicSMaxOp AtomicSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicSMaxOp AtomicSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMaxOp::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(); ::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."); } } AtomicSMaxOp AtomicSMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicSMaxOp::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(); ::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(AtomicSMaxOp::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)."); } } AtomicSMaxOp AtomicSMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicSMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicSMaxOp AtomicSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicSMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicSMaxOp::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)."); } } AtomicSMaxOp AtomicSMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMaxOp AtomicSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicSMaxOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicSMaxOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicSMaxOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicSMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicSMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicSMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicSMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicSMinOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicSMinOpGenericAdaptorBase::AtomicSMinOpGenericAdaptorBase(AtomicSMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicSMinOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicSMinOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicSMinOpAdaptor::AtomicSMinOpAdaptor(AtomicSMinOp op) : AtomicSMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicSMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicSMin' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicSMin' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicSMin' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicSMin' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicSMinOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicSMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicSMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicSMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicSMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicSMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicSMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicSMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicSMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicSMinOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicSMinOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicSMinOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicSMinOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicSMinOp AtomicSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicSMinOp::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); } AtomicSMinOp AtomicSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicSMinOp AtomicSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicSMinOp AtomicSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicSMinOp::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); } AtomicSMinOp AtomicSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicSMinOp AtomicSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicSMinOp::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(); ::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."); } } AtomicSMinOp AtomicSMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicSMinOp::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(); ::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(AtomicSMinOp::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)."); } } AtomicSMinOp AtomicSMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicSMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicSMinOp AtomicSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicSMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicSMinOp::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)."); } } AtomicSMinOp AtomicSMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicSMinOp AtomicSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicSMinOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicSMinOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicSMinOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicSMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicSMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicSMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicSMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicStoreOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicStoreOpGenericAdaptorBase::AtomicStoreOpGenericAdaptorBase(AtomicStoreOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicStoreOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicStoreOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicStoreOpAdaptor::AtomicStoreOpAdaptor(AtomicStoreOp op) : AtomicStoreOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicStoreOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicStore' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicStore' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicStore' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicStore' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicStoreOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicStoreOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicStoreOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicStoreOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicStoreOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicStoreOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; } AtomicStoreOp AtomicStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicStoreOp AtomicStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicStoreOp AtomicStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicStoreOp AtomicStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); } AtomicStoreOp AtomicStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicStoreOp AtomicStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicStoreOp AtomicStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicStoreOp AtomicStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicStoreOp::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(); ::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."); } } AtomicStoreOp AtomicStoreOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicStoreOp AtomicStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicStoreOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicStoreOp AtomicStoreOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicStoreOp AtomicStoreOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicStoreOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps6(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicStoreOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult AtomicStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicStoreOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicStoreOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicUMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicUMaxOpGenericAdaptorBase::AtomicUMaxOpGenericAdaptorBase(AtomicUMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicUMaxOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicUMaxOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicUMaxOpAdaptor::AtomicUMaxOpAdaptor(AtomicUMaxOp op) : AtomicUMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicUMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicUMax' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicUMax' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicUMax' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicUMax' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicUMaxOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicUMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicUMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicUMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicUMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicUMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicUMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicUMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicUMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicUMaxOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicUMaxOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicUMaxOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicUMaxOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicUMaxOp AtomicUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicUMaxOp::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); } AtomicUMaxOp AtomicUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicUMaxOp AtomicUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicUMaxOp AtomicUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicUMaxOp::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); } AtomicUMaxOp AtomicUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicUMaxOp AtomicUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMaxOp::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(); ::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."); } } AtomicUMaxOp AtomicUMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicUMaxOp::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(); ::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(AtomicUMaxOp::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)."); } } AtomicUMaxOp AtomicUMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicUMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicUMaxOp AtomicUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicUMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicUMaxOp::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)."); } } AtomicUMaxOp AtomicUMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMaxOp AtomicUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicUMaxOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicUMaxOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicUMaxOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicUMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicUMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicUMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicUMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicUMinOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicUMinOpGenericAdaptorBase::AtomicUMinOpGenericAdaptorBase(AtomicUMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicUMinOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicUMinOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicUMinOpAdaptor::AtomicUMinOpAdaptor(AtomicUMinOp op) : AtomicUMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicUMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicUMin' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicUMin' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicUMin' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicUMin' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicUMinOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicUMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicUMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicUMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicUMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicUMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicUMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicUMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicUMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicUMinOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicUMinOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicUMinOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicUMinOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicUMinOp AtomicUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicUMinOp::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); } AtomicUMinOp AtomicUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicUMinOp AtomicUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicUMinOp AtomicUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicUMinOp::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); } AtomicUMinOp AtomicUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicUMinOp AtomicUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicUMinOp::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(); ::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."); } } AtomicUMinOp AtomicUMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicUMinOp::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(); ::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(AtomicUMinOp::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)."); } } AtomicUMinOp AtomicUMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicUMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicUMinOp AtomicUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicUMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicUMinOp::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)."); } } AtomicUMinOp AtomicUMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicUMinOp AtomicUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicUMinOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicUMinOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicUMinOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicUMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicUMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicUMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicUMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::AtomicXorOp definitions //===----------------------------------------------------------------------===// namespace detail { AtomicXorOpGenericAdaptorBase::AtomicXorOpGenericAdaptorBase(AtomicXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope AtomicXorOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicXorOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail AtomicXorOpAdaptor::AtomicXorOpAdaptor(AtomicXorOp op) : AtomicXorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult AtomicXorOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.AtomicXor' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.AtomicXor' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.AtomicXor' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.AtomicXor' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult AtomicXorOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute AtomicXorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code AtomicXorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional AtomicXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void AtomicXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void AtomicXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult AtomicXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult AtomicXorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void AtomicXorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope AtomicXorOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics AtomicXorOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void AtomicXorOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicXorOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void AtomicXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } AtomicXorOp AtomicXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicXorOp::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); } AtomicXorOp AtomicXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicXorOp AtomicXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } AtomicXorOp AtomicXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicXorOp::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); } AtomicXorOp AtomicXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } AtomicXorOp AtomicXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void AtomicXorOp::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(); ::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."); } } AtomicXorOp AtomicXorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void AtomicXorOp::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(); ::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(AtomicXorOp::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)."); } } AtomicXorOp AtomicXorOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void AtomicXorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } AtomicXorOp AtomicXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void AtomicXorOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(AtomicXorOp::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)."); } } AtomicXorOp AtomicXorOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AtomicXorOp AtomicXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult AtomicXorOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult AtomicXorOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult AtomicXorOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult AtomicXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void AtomicXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::AtomicXorOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::AtomicXorOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitCountOp definitions //===----------------------------------------------------------------------===// namespace detail { BitCountOpGenericAdaptorBase::BitCountOpGenericAdaptorBase(BitCountOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitCountOpAdaptor::BitCountOpAdaptor(BitCountOp op) : BitCountOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitCountOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitCountOp::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 BitCountOp::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 BitCountOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitCountOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitCountOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitCountOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitCountOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } BitCountOp BitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitCountOp BitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void BitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitCountOp::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); } BitCountOp BitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitCountOp BitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void BitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitCountOp BitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitCountOp BitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void BitCountOp::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); } BitCountOp BitCountOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitCountOp BitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitCountOp::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(BitCountOp::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)."); } } BitCountOp BitCountOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitCountOp BitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void BitCountOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitCountOp BitCountOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitCountOp BitCountOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void BitCountOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitCountOp::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)."); } } BitCountOp BitCountOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitCountOp BitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitCountOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult BitCountOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult BitCountOp::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 BitCountOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitCountOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void BitCountOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitCountOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitFieldInsertOp definitions //===----------------------------------------------------------------------===// namespace detail { BitFieldInsertOpGenericAdaptorBase::BitFieldInsertOpGenericAdaptorBase(BitFieldInsertOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitFieldInsertOpAdaptor::BitFieldInsertOpAdaptor(BitFieldInsertOp op) : BitFieldInsertOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitFieldInsertOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitFieldInsertOp::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 BitFieldInsertOp::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 BitFieldInsertOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitFieldInsertOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitFieldInsertOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitFieldInsertOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitFieldInsertOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitFieldInsertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(insert); odsState.addOperands(offset); odsState.addOperands(count); odsState.addTypes(result); } BitFieldInsertOp BitFieldInsertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(base), std::forward(insert), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldInsertOp BitFieldInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(result), std::forward(base), std::forward(insert), std::forward(offset), std::forward(count)); } void BitFieldInsertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(insert); odsState.addOperands(offset); odsState.addOperands(count); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldInsertOp::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); } BitFieldInsertOp BitFieldInsertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(base), std::forward(insert), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldInsertOp BitFieldInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(base), std::forward(insert), std::forward(offset), std::forward(count)); } void BitFieldInsertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(insert); odsState.addOperands(offset); odsState.addOperands(count); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitFieldInsertOp BitFieldInsertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(base), std::forward(insert), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldInsertOp BitFieldInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value insert, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(base), std::forward(insert), std::forward(offset), std::forward(count)); } void BitFieldInsertOp::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); } BitFieldInsertOp BitFieldInsertOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldInsertOp BitFieldInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitFieldInsertOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldInsertOp::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)."); } } BitFieldInsertOp BitFieldInsertOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldInsertOp BitFieldInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void BitFieldInsertOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitFieldInsertOp BitFieldInsertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldInsertOp BitFieldInsertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void BitFieldInsertOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldInsertOp::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)."); } } BitFieldInsertOp BitFieldInsertOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldInsertOp BitFieldInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitFieldInsertOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps7(*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 {base, insert, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult BitFieldInsertOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult BitFieldInsertOp::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 BitFieldInsertOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type baseRawType{}; ::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1); ::mlir::Type offsetRawType{}; ::llvm::ArrayRef<::mlir::Type> offsetTypes(&offsetRawType, 1); ::mlir::Type countRawType{}; ::llvm::ArrayRef<::mlir::Type> countTypes(&countRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); baseRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); offsetRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); countRawType = type; } result.addTypes(baseTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(baseTypes), ::llvm::ArrayRef<::mlir::Type>(baseTypes[0]), ::llvm::ArrayRef<::mlir::Type>(offsetTypes), ::llvm::ArrayRef<::mlir::Type>(countTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitFieldInsertOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getBase().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getOffset().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(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; } } void BitFieldInsertOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitFieldInsertOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitFieldSExtractOp definitions //===----------------------------------------------------------------------===// namespace detail { BitFieldSExtractOpGenericAdaptorBase::BitFieldSExtractOpGenericAdaptorBase(BitFieldSExtractOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitFieldSExtractOpAdaptor::BitFieldSExtractOpAdaptor(BitFieldSExtractOp op) : BitFieldSExtractOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitFieldSExtractOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitFieldSExtractOp::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 BitFieldSExtractOp::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 BitFieldSExtractOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitFieldSExtractOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitFieldSExtractOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitFieldSExtractOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitFieldSExtractOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitFieldSExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(offset); odsState.addOperands(count); odsState.addTypes(result); } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(base), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(result), std::forward(base), std::forward(offset), std::forward(count)); } void BitFieldSExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(offset); odsState.addOperands(count); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldSExtractOp::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); } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(base), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(base), std::forward(offset), std::forward(count)); } void BitFieldSExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(offset); odsState.addOperands(count); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(base), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(base), std::forward(offset), std::forward(count)); } void BitFieldSExtractOp::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); } BitFieldSExtractOp BitFieldSExtractOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitFieldSExtractOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldSExtractOp::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)."); } } BitFieldSExtractOp BitFieldSExtractOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void BitFieldSExtractOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitFieldSExtractOp BitFieldSExtractOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldSExtractOp BitFieldSExtractOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void BitFieldSExtractOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldSExtractOp::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)."); } } BitFieldSExtractOp BitFieldSExtractOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldSExtractOp BitFieldSExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitFieldSExtractOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {base, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult BitFieldSExtractOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult BitFieldSExtractOp::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 BitFieldSExtractOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type baseRawType{}; ::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1); ::mlir::Type offsetRawType{}; ::llvm::ArrayRef<::mlir::Type> offsetTypes(&offsetRawType, 1); ::mlir::Type countRawType{}; ::llvm::ArrayRef<::mlir::Type> countTypes(&countRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); baseRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); offsetRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); countRawType = type; } result.addTypes(baseTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(baseTypes), ::llvm::ArrayRef<::mlir::Type>(offsetTypes), ::llvm::ArrayRef<::mlir::Type>(countTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitFieldSExtractOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getBase().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getOffset().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(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; } } void BitFieldSExtractOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitFieldSExtractOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitFieldUExtractOp definitions //===----------------------------------------------------------------------===// namespace detail { BitFieldUExtractOpGenericAdaptorBase::BitFieldUExtractOpGenericAdaptorBase(BitFieldUExtractOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitFieldUExtractOpAdaptor::BitFieldUExtractOpAdaptor(BitFieldUExtractOp op) : BitFieldUExtractOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitFieldUExtractOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitFieldUExtractOp::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 BitFieldUExtractOp::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 BitFieldUExtractOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitFieldUExtractOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitFieldUExtractOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitFieldUExtractOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitFieldUExtractOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitFieldUExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(offset); odsState.addOperands(count); odsState.addTypes(result); } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(base), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(result), std::forward(base), std::forward(offset), std::forward(count)); } void BitFieldUExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(offset); odsState.addOperands(count); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldUExtractOp::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); } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(base), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(base), std::forward(offset), std::forward(count)); } void BitFieldUExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { odsState.addOperands(base); odsState.addOperands(offset); odsState.addOperands(count); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(base), std::forward(offset), std::forward(count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value offset, ::mlir::Value count) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(base), std::forward(offset), std::forward(count)); } void BitFieldUExtractOp::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); } BitFieldUExtractOp BitFieldUExtractOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitFieldUExtractOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldUExtractOp::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)."); } } BitFieldUExtractOp BitFieldUExtractOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void BitFieldUExtractOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitFieldUExtractOp BitFieldUExtractOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldUExtractOp BitFieldUExtractOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void BitFieldUExtractOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitFieldUExtractOp::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)."); } } BitFieldUExtractOp BitFieldUExtractOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitFieldUExtractOp BitFieldUExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitFieldUExtractOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {base, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult BitFieldUExtractOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult BitFieldUExtractOp::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 BitFieldUExtractOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type baseRawType{}; ::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1); ::mlir::Type offsetRawType{}; ::llvm::ArrayRef<::mlir::Type> offsetTypes(&offsetRawType, 1); ::mlir::Type countRawType{}; ::llvm::ArrayRef<::mlir::Type> countTypes(&countRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); baseRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); offsetRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); countRawType = type; } result.addTypes(baseTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(baseTypes), ::llvm::ArrayRef<::mlir::Type>(offsetTypes), ::llvm::ArrayRef<::mlir::Type>(countTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitFieldUExtractOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getBase().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getOffset().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(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; } } void BitFieldUExtractOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitFieldUExtractOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitReverseOp definitions //===----------------------------------------------------------------------===// namespace detail { BitReverseOpGenericAdaptorBase::BitReverseOpGenericAdaptorBase(BitReverseOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitReverseOpAdaptor::BitReverseOpAdaptor(BitReverseOp op) : BitReverseOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitReverseOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitReverseOp::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 BitReverseOp::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 BitReverseOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitReverseOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitReverseOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitReverseOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitReverseOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } BitReverseOp BitReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitReverseOp BitReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void BitReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitReverseOp::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); } BitReverseOp BitReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitReverseOp BitReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void BitReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitReverseOp BitReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitReverseOp BitReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void BitReverseOp::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); } BitReverseOp BitReverseOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitReverseOp BitReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitReverseOp::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(BitReverseOp::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)."); } } BitReverseOp BitReverseOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitReverseOp BitReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void BitReverseOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitReverseOp BitReverseOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitReverseOp BitReverseOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void BitReverseOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitReverseOp::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)."); } } BitReverseOp BitReverseOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitReverseOp BitReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitReverseOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult BitReverseOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult BitReverseOp::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 BitReverseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitReverseOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void BitReverseOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitReverseOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitcastOp definitions //===----------------------------------------------------------------------===// namespace detail { BitcastOpGenericAdaptorBase::BitcastOpGenericAdaptorBase(BitcastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitcastOpAdaptor::BitcastOpAdaptor(BitcastOp op) : BitcastOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitcastOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitcastOp::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 BitcastOp::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 BitcastOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitcastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitcastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitcastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitcastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } BitcastOp BitcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitcastOp BitcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitcastOp BitcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitcastOp BitcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void BitcastOp::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); } BitcastOp BitcastOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitcastOp BitcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitcastOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitcastOp BitcastOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitcastOp BitcastOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitcastOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps8(*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_SPIRVOps8(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult BitcastOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult BitcastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitcastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void BitcastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitcastOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitwiseAndOp definitions //===----------------------------------------------------------------------===// namespace detail { BitwiseAndOpGenericAdaptorBase::BitwiseAndOpGenericAdaptorBase(BitwiseAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitwiseAndOpAdaptor::BitwiseAndOpAdaptor(BitwiseAndOp op) : BitwiseAndOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitwiseAndOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitwiseAndOp::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 BitwiseAndOp::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 BitwiseAndOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitwiseAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitwiseAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitwiseAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitwiseAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } BitwiseAndOp BitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void BitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitwiseAndOp::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); } BitwiseAndOp BitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void BitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitwiseAndOp BitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void BitwiseAndOp::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); } BitwiseAndOp BitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitwiseAndOp::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(BitwiseAndOp::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)."); } } BitwiseAndOp BitwiseAndOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void BitwiseAndOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitwiseAndOp BitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseAndOp BitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void BitwiseAndOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitwiseAndOp::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)."); } } BitwiseAndOp BitwiseAndOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitwiseAndOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult BitwiseAndOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult BitwiseAndOp::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 BitwiseAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitwiseAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 BitwiseAndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitwiseAndOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitwiseOrOp definitions //===----------------------------------------------------------------------===// namespace detail { BitwiseOrOpGenericAdaptorBase::BitwiseOrOpGenericAdaptorBase(BitwiseOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitwiseOrOpAdaptor::BitwiseOrOpAdaptor(BitwiseOrOp op) : BitwiseOrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitwiseOrOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitwiseOrOp::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 BitwiseOrOp::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 BitwiseOrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitwiseOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitwiseOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitwiseOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitwiseOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } BitwiseOrOp BitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void BitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitwiseOrOp::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); } BitwiseOrOp BitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void BitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitwiseOrOp BitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void BitwiseOrOp::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); } BitwiseOrOp BitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitwiseOrOp::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(BitwiseOrOp::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)."); } } BitwiseOrOp BitwiseOrOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void BitwiseOrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitwiseOrOp BitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseOrOp BitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void BitwiseOrOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitwiseOrOp::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)."); } } BitwiseOrOp BitwiseOrOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitwiseOrOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult BitwiseOrOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult BitwiseOrOp::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 BitwiseOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitwiseOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 BitwiseOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitwiseOrOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BitwiseXorOp definitions //===----------------------------------------------------------------------===// namespace detail { BitwiseXorOpGenericAdaptorBase::BitwiseXorOpGenericAdaptorBase(BitwiseXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail BitwiseXorOpAdaptor::BitwiseXorOpAdaptor(BitwiseXorOp op) : BitwiseXorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BitwiseXorOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult BitwiseXorOp::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 BitwiseXorOp::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 BitwiseXorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BitwiseXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BitwiseXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BitwiseXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BitwiseXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } BitwiseXorOp BitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void BitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitwiseXorOp::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); } BitwiseXorOp BitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void BitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } BitwiseXorOp BitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void BitwiseXorOp::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); } BitwiseXorOp BitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BitwiseXorOp::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(BitwiseXorOp::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)."); } } BitwiseXorOp BitwiseXorOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void BitwiseXorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BitwiseXorOp BitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseXorOp BitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void BitwiseXorOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(BitwiseXorOp::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)."); } } BitwiseXorOp BitwiseXorOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BitwiseXorOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult BitwiseXorOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult BitwiseXorOp::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 BitwiseXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BitwiseXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 BitwiseXorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BitwiseXorOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BranchConditionalOp definitions //===----------------------------------------------------------------------===// namespace detail { BranchConditionalOpGenericAdaptorBase::BranchConditionalOpGenericAdaptorBase(BranchConditionalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair BranchConditionalOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; unsigned start = 0; for (unsigned i = 0; i < index; ++i) start += sizeAttr[i]; return {start, sizeAttr[index]}; } ::std::optional< ::mlir::ArrayAttr > BranchConditionalOpGenericAdaptorBase::getBranchWeights() { auto attr = getBranchWeightsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } } // namespace detail BranchConditionalOpAdaptor::BranchConditionalOpAdaptor(BranchConditionalOp op) : BranchConditionalOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BranchConditionalOpAdaptor::verify(::mlir::Location loc) { auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; if (tblgen_branch_weights && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_branch_weights))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_branch_weights), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) return emitError(loc, "'spirv.BranchConditional' op attribute 'branch_weights' failed to satisfy constraint: 32-bit integer array attribute"); return ::mlir::success(); } std::pair BranchConditionalOp::getODSOperandIndexAndLength(unsigned index) { ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; unsigned start = 0; for (unsigned i = 0; i < index; ++i) start += sizeAttr[i]; return {start, sizeAttr[index]}; } ::mlir::MutableOperandRange BranchConditionalOp::getTrueTargetOperandsMutable() { 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 BranchConditionalOp::getFalseTargetOperandsMutable() { 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 BranchConditionalOp::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.branch_weights; auto attr = dict.get("branch_weights"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `branch_weights` 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 BranchConditionalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.branch_weights; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("branch_weights", 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 BranchConditionalOp::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.branch_weights.getAsOpaquePointer()), hash_operandSegmentSizes_(prop.operandSegmentSizes)); } std::optional BranchConditionalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "branch_weights") return prop.branch_weights; if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }(); return std::nullopt; } void BranchConditionalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "branch_weights") { prop.branch_weights = ::llvm::dyn_cast_or_null>(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 BranchConditionalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.branch_weights) attrs.append("branch_weights", prop.branch_weights); attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }()); } ::llvm::LogicalResult BranchConditionalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getBranchWeightsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(attr, "branch_weights", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult BranchConditionalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.branch_weights))) 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(sizeof(propStorage) / sizeof(int32_t))) { reader.emitError("size mismatch for operand/result_segment_size"); return ::mlir::failure(); } ::llvm::copy(::llvm::ArrayRef(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 BranchConditionalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.branch_weights); 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)); ; } } ::std::optional< ::mlir::ArrayAttr > BranchConditionalOp::getBranchWeights() { auto attr = getBranchWeightsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } void BranchConditionalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueBlock, ValueRange trueArguments, Block *falseBlock, ValueRange falseArguments, std::optional> weights) { ArrayAttr weightsAttr; if (weights) { weightsAttr = odsBuilder.getI32ArrayAttr({static_cast(weights->first), static_cast(weights->second)}); } build(odsBuilder, odsState, condition, trueArguments, falseArguments, weightsAttr, trueBlock, falseBlock); } BranchConditionalOp BranchConditionalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value condition, Block *trueBlock, ValueRange trueArguments, Block *falseBlock, ValueRange falseArguments, std::optional> weights) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(condition), std::forward(trueBlock), std::forward(trueArguments), std::forward(falseBlock), std::forward(falseArguments), std::forward(weights)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BranchConditionalOp BranchConditionalOp::create(::mlir::ImplicitLocOpBuilder &builder, Value condition, Block *trueBlock, ValueRange trueArguments, Block *falseBlock, ValueRange falseArguments, std::optional> weights) { return create(builder, builder.getLoc(), std::forward(condition), std::forward(trueBlock), std::forward(trueArguments), std::forward(falseBlock), std::forward(falseArguments), std::forward(weights)); } void BranchConditionalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange trueTargetOperands, ::mlir::ValueRange falseTargetOperands, /*optional*/::mlir::ArrayAttr branch_weights, ::mlir::Block *trueTarget, ::mlir::Block *falseTarget) { odsState.addOperands(condition); odsState.addOperands(trueTargetOperands); odsState.addOperands(falseTargetOperands); ::llvm::copy(::llvm::ArrayRef({1, static_cast(trueTargetOperands.size()), static_cast(falseTargetOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); if (branch_weights) { odsState.getOrAddProperties().branch_weights = branch_weights; } odsState.addSuccessors(trueTarget); odsState.addSuccessors(falseTarget); } BranchConditionalOp BranchConditionalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value condition, ::mlir::ValueRange trueTargetOperands, ::mlir::ValueRange falseTargetOperands, /*optional*/::mlir::ArrayAttr branch_weights, ::mlir::Block *trueTarget, ::mlir::Block *falseTarget) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(condition), std::forward(trueTargetOperands), std::forward(falseTargetOperands), std::forward(branch_weights), std::forward(trueTarget), std::forward(falseTarget)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BranchConditionalOp BranchConditionalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value condition, ::mlir::ValueRange trueTargetOperands, ::mlir::ValueRange falseTargetOperands, /*optional*/::mlir::ArrayAttr branch_weights, ::mlir::Block *trueTarget, ::mlir::Block *falseTarget) { return create(builder, builder.getLoc(), std::forward(condition), std::forward(trueTargetOperands), std::forward(falseTargetOperands), std::forward(branch_weights), std::forward(trueTarget), std::forward(falseTarget)); } void BranchConditionalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueTargetOperands, ::mlir::ValueRange falseTargetOperands, /*optional*/::mlir::ArrayAttr branch_weights, ::mlir::Block *trueTarget, ::mlir::Block *falseTarget) { odsState.addOperands(condition); odsState.addOperands(trueTargetOperands); odsState.addOperands(falseTargetOperands); ::llvm::copy(::llvm::ArrayRef({1, static_cast(trueTargetOperands.size()), static_cast(falseTargetOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); if (branch_weights) { odsState.getOrAddProperties().branch_weights = branch_weights; } odsState.addSuccessors(trueTarget); odsState.addSuccessors(falseTarget); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } BranchConditionalOp BranchConditionalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueTargetOperands, ::mlir::ValueRange falseTargetOperands, /*optional*/::mlir::ArrayAttr branch_weights, ::mlir::Block *trueTarget, ::mlir::Block *falseTarget) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(condition), std::forward(trueTargetOperands), std::forward(falseTargetOperands), std::forward(branch_weights), std::forward(trueTarget), std::forward(falseTarget)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BranchConditionalOp BranchConditionalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueTargetOperands, ::mlir::ValueRange falseTargetOperands, /*optional*/::mlir::ArrayAttr branch_weights, ::mlir::Block *trueTarget, ::mlir::Block *falseTarget) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(condition), std::forward(trueTargetOperands), std::forward(falseTargetOperands), std::forward(branch_weights), std::forward(trueTarget), std::forward(falseTarget)); } void BranchConditionalOp::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(); ::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."); } } BranchConditionalOp BranchConditionalOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BranchConditionalOp BranchConditionalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void BranchConditionalOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } BranchConditionalOp BranchConditionalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BranchConditionalOp BranchConditionalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult BranchConditionalOp::verifyInvariantsImpl() { auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(*this, tblgen_branch_weights, "branch_weights"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps4(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); { unsigned index = 0; (void)index; } return ::mlir::success(); } ::llvm::LogicalResult BranchConditionalOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult BranchConditionalOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.branch_weights; auto branch_weightsAttrName = ::mlir::StringAttr::get(ctx, "branch_weights"); auto attr = dict.get(branch_weightsAttrName); usedKeys.insert(branch_weightsAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for branch_weights in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void BranchConditionalOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BranchConditionalOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::BranchConditionalOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::BranchOp definitions //===----------------------------------------------------------------------===// namespace detail { BranchOpGenericAdaptorBase::BranchOpGenericAdaptorBase(BranchOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair BranchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {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 - 0) / 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 BranchOpAdaptor::BranchOpAdaptor(BranchOp op) : BranchOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult BranchOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair BranchOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {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() - 0) / 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 BranchOp::getTargetOperandsMutable() { auto range = getODSOperandIndexAndLength(0); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult BranchOp::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 BranchOp::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 BranchOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional BranchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void BranchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void BranchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult BranchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void BranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Block *successor, ValueRange arguments) { odsState.addSuccessors(successor); odsState.addOperands(arguments); } BranchOp BranchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Block *successor, ValueRange arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(successor), std::forward(arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } BranchOp BranchOp::create(::mlir::ImplicitLocOpBuilder &builder, Block *successor, ValueRange arguments) { return create(builder, builder.getLoc(), std::forward(successor), std::forward(arguments)); } ::llvm::LogicalResult BranchOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); { unsigned index = 0; (void)index; } return ::mlir::success(); } ::llvm::LogicalResult BranchOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult BranchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::Block *targetSuccessor = nullptr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> targetOperandsOperands; ::llvm::SMLoc targetOperandsOperandsLoc; (void)targetOperandsOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> targetOperandsTypes; if (parser.parseSuccessor(targetSuccessor)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalLParen())) { targetOperandsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(targetOperandsOperands)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); if (parser.parseTypeList(targetOperandsTypes)) return ::mlir::failure(); 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(); } result.addSuccessors(targetSuccessor); if (parser.resolveOperands(targetOperandsOperands, targetOperandsTypes, targetOperandsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void BranchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getTarget(); if (!getTargetOperands().empty()) { _odsPrinter << "("; _odsPrinter << getTargetOperands(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getTargetOperands().getTypes(); _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void BranchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::BranchOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLAcosOp definitions //===----------------------------------------------------------------------===// namespace detail { CLAcosOpGenericAdaptorBase::CLAcosOpGenericAdaptorBase(CLAcosOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLAcosOpAdaptor::CLAcosOpAdaptor(CLAcosOp op) : CLAcosOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLAcosOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLAcosOp::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 CLAcosOp::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 CLAcosOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLAcosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLAcosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLAcosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLAcosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLAcosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLAcosOp CLAcosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcosOp CLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLAcosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAcosOp::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); } CLAcosOp CLAcosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcosOp CLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLAcosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLAcosOp CLAcosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcosOp CLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLAcosOp::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); } CLAcosOp CLAcosOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcosOp CLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLAcosOp::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(CLAcosOp::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)."); } } CLAcosOp CLAcosOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcosOp CLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLAcosOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLAcosOp CLAcosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcosOp CLAcosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLAcosOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAcosOp::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)."); } } CLAcosOp CLAcosOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcosOp CLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLAcosOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLAcosOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLAcosOp::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 CLAcosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLAcosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLAcosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLAcosOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLAcoshOp definitions //===----------------------------------------------------------------------===// namespace detail { CLAcoshOpGenericAdaptorBase::CLAcoshOpGenericAdaptorBase(CLAcoshOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLAcoshOpAdaptor::CLAcoshOpAdaptor(CLAcoshOp op) : CLAcoshOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLAcoshOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLAcoshOp::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 CLAcoshOp::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 CLAcoshOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLAcoshOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLAcoshOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLAcoshOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLAcoshOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLAcoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLAcoshOp CLAcoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcoshOp CLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLAcoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAcoshOp::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); } CLAcoshOp CLAcoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcoshOp CLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLAcoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLAcoshOp CLAcoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcoshOp CLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLAcoshOp::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); } CLAcoshOp CLAcoshOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcoshOp CLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLAcoshOp::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(CLAcoshOp::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)."); } } CLAcoshOp CLAcoshOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcoshOp CLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLAcoshOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLAcoshOp CLAcoshOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcoshOp CLAcoshOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLAcoshOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAcoshOp::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)."); } } CLAcoshOp CLAcoshOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAcoshOp CLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLAcoshOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLAcoshOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLAcoshOp::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 CLAcoshOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLAcoshOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLAcoshOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLAcoshOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLAsinOp definitions //===----------------------------------------------------------------------===// namespace detail { CLAsinOpGenericAdaptorBase::CLAsinOpGenericAdaptorBase(CLAsinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLAsinOpAdaptor::CLAsinOpAdaptor(CLAsinOp op) : CLAsinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLAsinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLAsinOp::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 CLAsinOp::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 CLAsinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLAsinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLAsinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLAsinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLAsinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLAsinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLAsinOp CLAsinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinOp CLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLAsinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAsinOp::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); } CLAsinOp CLAsinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinOp CLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLAsinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLAsinOp CLAsinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinOp CLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLAsinOp::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); } CLAsinOp CLAsinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinOp CLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLAsinOp::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(CLAsinOp::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)."); } } CLAsinOp CLAsinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinOp CLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLAsinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLAsinOp CLAsinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinOp CLAsinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLAsinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAsinOp::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)."); } } CLAsinOp CLAsinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinOp CLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLAsinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLAsinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLAsinOp::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 CLAsinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLAsinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLAsinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLAsinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLAsinhOp definitions //===----------------------------------------------------------------------===// namespace detail { CLAsinhOpGenericAdaptorBase::CLAsinhOpGenericAdaptorBase(CLAsinhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLAsinhOpAdaptor::CLAsinhOpAdaptor(CLAsinhOp op) : CLAsinhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLAsinhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLAsinhOp::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 CLAsinhOp::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 CLAsinhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLAsinhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLAsinhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLAsinhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLAsinhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLAsinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLAsinhOp CLAsinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinhOp CLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLAsinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAsinhOp::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); } CLAsinhOp CLAsinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinhOp CLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLAsinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLAsinhOp CLAsinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinhOp CLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLAsinhOp::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); } CLAsinhOp CLAsinhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinhOp CLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLAsinhOp::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(CLAsinhOp::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)."); } } CLAsinhOp CLAsinhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinhOp CLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLAsinhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLAsinhOp CLAsinhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinhOp CLAsinhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLAsinhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAsinhOp::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)."); } } CLAsinhOp CLAsinhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAsinhOp CLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLAsinhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLAsinhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLAsinhOp::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 CLAsinhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLAsinhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLAsinhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLAsinhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLAtan2Op definitions //===----------------------------------------------------------------------===// namespace detail { CLAtan2OpGenericAdaptorBase::CLAtan2OpGenericAdaptorBase(CLAtan2Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLAtan2OpAdaptor::CLAtan2OpAdaptor(CLAtan2Op op) : CLAtan2OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLAtan2OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLAtan2Op::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 CLAtan2Op::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 CLAtan2Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLAtan2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLAtan2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLAtan2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLAtan2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLAtan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } CLAtan2Op CLAtan2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtan2Op CLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void CLAtan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAtan2Op::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); } CLAtan2Op CLAtan2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtan2Op CLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void CLAtan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLAtan2Op CLAtan2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtan2Op CLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void CLAtan2Op::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); } CLAtan2Op CLAtan2Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtan2Op CLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLAtan2Op::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(CLAtan2Op::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)."); } } CLAtan2Op CLAtan2Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtan2Op CLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLAtan2Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLAtan2Op CLAtan2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtan2Op CLAtan2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLAtan2Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAtan2Op::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)."); } } CLAtan2Op CLAtan2Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtan2Op CLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLAtan2Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLAtan2Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLAtan2Op::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 CLAtan2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLAtan2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLAtan2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLAtan2Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLAtanOp definitions //===----------------------------------------------------------------------===// namespace detail { CLAtanOpGenericAdaptorBase::CLAtanOpGenericAdaptorBase(CLAtanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLAtanOpAdaptor::CLAtanOpAdaptor(CLAtanOp op) : CLAtanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLAtanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLAtanOp::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 CLAtanOp::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 CLAtanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLAtanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLAtanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLAtanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLAtanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLAtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLAtanOp CLAtanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanOp CLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLAtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAtanOp::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); } CLAtanOp CLAtanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanOp CLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLAtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLAtanOp CLAtanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanOp CLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLAtanOp::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); } CLAtanOp CLAtanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanOp CLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLAtanOp::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(CLAtanOp::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)."); } } CLAtanOp CLAtanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanOp CLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLAtanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLAtanOp CLAtanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanOp CLAtanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLAtanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAtanOp::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)."); } } CLAtanOp CLAtanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanOp CLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLAtanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLAtanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLAtanOp::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 CLAtanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLAtanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLAtanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLAtanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLAtanhOp definitions //===----------------------------------------------------------------------===// namespace detail { CLAtanhOpGenericAdaptorBase::CLAtanhOpGenericAdaptorBase(CLAtanhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLAtanhOpAdaptor::CLAtanhOpAdaptor(CLAtanhOp op) : CLAtanhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLAtanhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLAtanhOp::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 CLAtanhOp::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 CLAtanhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLAtanhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLAtanhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLAtanhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLAtanhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLAtanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLAtanhOp CLAtanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanhOp CLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLAtanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAtanhOp::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); } CLAtanhOp CLAtanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanhOp CLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLAtanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLAtanhOp CLAtanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanhOp CLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLAtanhOp::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); } CLAtanhOp CLAtanhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanhOp CLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLAtanhOp::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(CLAtanhOp::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)."); } } CLAtanhOp CLAtanhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanhOp CLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLAtanhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLAtanhOp CLAtanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanhOp CLAtanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLAtanhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLAtanhOp::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)."); } } CLAtanhOp CLAtanhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLAtanhOp CLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLAtanhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLAtanhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLAtanhOp::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 CLAtanhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLAtanhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLAtanhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLAtanhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLCbrtOp definitions //===----------------------------------------------------------------------===// namespace detail { CLCbrtOpGenericAdaptorBase::CLCbrtOpGenericAdaptorBase(CLCbrtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLCbrtOpAdaptor::CLCbrtOpAdaptor(CLCbrtOp op) : CLCbrtOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLCbrtOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLCbrtOp::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 CLCbrtOp::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 CLCbrtOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLCbrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLCbrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLCbrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLCbrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLCbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLCbrtOp CLCbrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCbrtOp CLCbrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLCbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLCbrtOp::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); } CLCbrtOp CLCbrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCbrtOp CLCbrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLCbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLCbrtOp CLCbrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCbrtOp CLCbrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLCbrtOp::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); } CLCbrtOp CLCbrtOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCbrtOp CLCbrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLCbrtOp::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(CLCbrtOp::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)."); } } CLCbrtOp CLCbrtOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCbrtOp CLCbrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLCbrtOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLCbrtOp CLCbrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCbrtOp CLCbrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLCbrtOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLCbrtOp::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)."); } } CLCbrtOp CLCbrtOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCbrtOp CLCbrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLCbrtOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLCbrtOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLCbrtOp::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 CLCbrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLCbrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLCbrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLCbrtOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLCeilOp definitions //===----------------------------------------------------------------------===// namespace detail { CLCeilOpGenericAdaptorBase::CLCeilOpGenericAdaptorBase(CLCeilOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLCeilOpAdaptor::CLCeilOpAdaptor(CLCeilOp op) : CLCeilOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLCeilOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLCeilOp::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 CLCeilOp::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 CLCeilOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLCeilOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLCeilOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLCeilOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLCeilOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLCeilOp CLCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCeilOp CLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLCeilOp::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); } CLCeilOp CLCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCeilOp CLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLCeilOp CLCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCeilOp CLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLCeilOp::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); } CLCeilOp CLCeilOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCeilOp CLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLCeilOp::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(CLCeilOp::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)."); } } CLCeilOp CLCeilOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCeilOp CLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLCeilOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLCeilOp CLCeilOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCeilOp CLCeilOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLCeilOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLCeilOp::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)."); } } CLCeilOp CLCeilOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCeilOp CLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLCeilOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLCeilOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLCeilOp::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 CLCeilOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLCeilOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLCeilOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLCeilOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLClzOp definitions //===----------------------------------------------------------------------===// namespace detail { CLClzOpGenericAdaptorBase::CLClzOpGenericAdaptorBase(CLClzOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLClzOpAdaptor::CLClzOpAdaptor(CLClzOp op) : CLClzOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLClzOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLClzOp::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 CLClzOp::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 CLClzOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLClzOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLClzOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLClzOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLClzOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLClzOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLClzOp CLClzOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLClzOp CLClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLClzOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLClzOp::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); } CLClzOp CLClzOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLClzOp CLClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLClzOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLClzOp CLClzOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLClzOp CLClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLClzOp::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); } CLClzOp CLClzOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLClzOp CLClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLClzOp::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(CLClzOp::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)."); } } CLClzOp CLClzOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLClzOp CLClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLClzOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLClzOp CLClzOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLClzOp CLClzOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLClzOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLClzOp::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)."); } } CLClzOp CLClzOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLClzOp CLClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLClzOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLClzOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLClzOp::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 CLClzOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLClzOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLClzOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLClzOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLCosOp definitions //===----------------------------------------------------------------------===// namespace detail { CLCosOpGenericAdaptorBase::CLCosOpGenericAdaptorBase(CLCosOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLCosOpAdaptor::CLCosOpAdaptor(CLCosOp op) : CLCosOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLCosOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLCosOp::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 CLCosOp::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 CLCosOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLCosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLCosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLCosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLCosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLCosOp CLCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCosOp CLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLCosOp::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); } CLCosOp CLCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCosOp CLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLCosOp CLCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCosOp CLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLCosOp::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); } CLCosOp CLCosOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCosOp CLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLCosOp::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(CLCosOp::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)."); } } CLCosOp CLCosOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCosOp CLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLCosOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLCosOp CLCosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCosOp CLCosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLCosOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLCosOp::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)."); } } CLCosOp CLCosOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCosOp CLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLCosOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLCosOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLCosOp::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 CLCosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLCosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLCosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLCosOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLCoshOp definitions //===----------------------------------------------------------------------===// namespace detail { CLCoshOpGenericAdaptorBase::CLCoshOpGenericAdaptorBase(CLCoshOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLCoshOpAdaptor::CLCoshOpAdaptor(CLCoshOp op) : CLCoshOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLCoshOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLCoshOp::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 CLCoshOp::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 CLCoshOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLCoshOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLCoshOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLCoshOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLCoshOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLCoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLCoshOp CLCoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCoshOp CLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLCoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLCoshOp::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); } CLCoshOp CLCoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCoshOp CLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLCoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLCoshOp CLCoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCoshOp CLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLCoshOp::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); } CLCoshOp CLCoshOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCoshOp CLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLCoshOp::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(CLCoshOp::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)."); } } CLCoshOp CLCoshOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCoshOp CLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLCoshOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLCoshOp CLCoshOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCoshOp CLCoshOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLCoshOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLCoshOp::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)."); } } CLCoshOp CLCoshOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLCoshOp CLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLCoshOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLCoshOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLCoshOp::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 CLCoshOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLCoshOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLCoshOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLCoshOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLErfOp definitions //===----------------------------------------------------------------------===// namespace detail { CLErfOpGenericAdaptorBase::CLErfOpGenericAdaptorBase(CLErfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLErfOpAdaptor::CLErfOpAdaptor(CLErfOp op) : CLErfOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLErfOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLErfOp::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 CLErfOp::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 CLErfOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLErfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLErfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLErfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLErfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLErfOp CLErfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfOp CLErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLErfOp::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); } CLErfOp CLErfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfOp CLErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLErfOp CLErfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfOp CLErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLErfOp::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); } CLErfOp CLErfOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfOp CLErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLErfOp::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(CLErfOp::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)."); } } CLErfOp CLErfOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfOp CLErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLErfOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLErfOp CLErfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfOp CLErfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLErfOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLErfOp::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)."); } } CLErfOp CLErfOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfOp CLErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLErfOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLErfOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLErfOp::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 CLErfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLErfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLErfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLErfOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLErfcOp definitions //===----------------------------------------------------------------------===// namespace detail { CLErfcOpGenericAdaptorBase::CLErfcOpGenericAdaptorBase(CLErfcOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLErfcOpAdaptor::CLErfcOpAdaptor(CLErfcOp op) : CLErfcOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLErfcOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLErfcOp::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 CLErfcOp::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 CLErfcOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLErfcOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLErfcOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLErfcOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLErfcOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLErfcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLErfcOp CLErfcOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfcOp CLErfcOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLErfcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLErfcOp::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); } CLErfcOp CLErfcOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfcOp CLErfcOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLErfcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLErfcOp CLErfcOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfcOp CLErfcOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLErfcOp::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); } CLErfcOp CLErfcOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfcOp CLErfcOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLErfcOp::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(CLErfcOp::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)."); } } CLErfcOp CLErfcOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfcOp CLErfcOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLErfcOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLErfcOp CLErfcOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfcOp CLErfcOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLErfcOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLErfcOp::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)."); } } CLErfcOp CLErfcOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLErfcOp CLErfcOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLErfcOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLErfcOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLErfcOp::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 CLErfcOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLErfcOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLErfcOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLErfcOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLExp10Op definitions //===----------------------------------------------------------------------===// namespace detail { CLExp10OpGenericAdaptorBase::CLExp10OpGenericAdaptorBase(CLExp10Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLExp10OpAdaptor::CLExp10OpAdaptor(CLExp10Op op) : CLExp10OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLExp10OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLExp10Op::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 CLExp10Op::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 CLExp10Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLExp10Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLExp10Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLExp10Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLExp10Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLExp10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLExp10Op CLExp10Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp10Op CLExp10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLExp10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLExp10Op::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); } CLExp10Op CLExp10Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp10Op CLExp10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLExp10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLExp10Op CLExp10Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp10Op CLExp10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLExp10Op::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); } CLExp10Op CLExp10Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp10Op CLExp10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLExp10Op::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(CLExp10Op::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)."); } } CLExp10Op CLExp10Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp10Op CLExp10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLExp10Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLExp10Op CLExp10Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp10Op CLExp10Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLExp10Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLExp10Op::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)."); } } CLExp10Op CLExp10Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp10Op CLExp10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLExp10Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLExp10Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLExp10Op::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 CLExp10Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLExp10Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLExp10Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLExp10Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLExp2Op definitions //===----------------------------------------------------------------------===// namespace detail { CLExp2OpGenericAdaptorBase::CLExp2OpGenericAdaptorBase(CLExp2Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLExp2OpAdaptor::CLExp2OpAdaptor(CLExp2Op op) : CLExp2OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLExp2OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLExp2Op::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 CLExp2Op::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 CLExp2Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLExp2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLExp2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLExp2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLExp2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLExp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLExp2Op CLExp2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp2Op CLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLExp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLExp2Op::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); } CLExp2Op CLExp2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp2Op CLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLExp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLExp2Op CLExp2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp2Op CLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLExp2Op::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); } CLExp2Op CLExp2Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp2Op CLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLExp2Op::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(CLExp2Op::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)."); } } CLExp2Op CLExp2Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp2Op CLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLExp2Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLExp2Op CLExp2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp2Op CLExp2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLExp2Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLExp2Op::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)."); } } CLExp2Op CLExp2Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExp2Op CLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLExp2Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLExp2Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLExp2Op::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 CLExp2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLExp2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLExp2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLExp2Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLExpOp definitions //===----------------------------------------------------------------------===// namespace detail { CLExpOpGenericAdaptorBase::CLExpOpGenericAdaptorBase(CLExpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLExpOpAdaptor::CLExpOpAdaptor(CLExpOp op) : CLExpOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLExpOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLExpOp::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 CLExpOp::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 CLExpOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLExpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLExpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLExpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLExpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLExpOp CLExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpOp CLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLExpOp::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); } CLExpOp CLExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpOp CLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLExpOp CLExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpOp CLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLExpOp::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); } CLExpOp CLExpOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpOp CLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLExpOp::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(CLExpOp::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)."); } } CLExpOp CLExpOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpOp CLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLExpOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLExpOp CLExpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpOp CLExpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLExpOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLExpOp::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)."); } } CLExpOp CLExpOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpOp CLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLExpOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLExpOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLExpOp::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 CLExpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLExpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLExpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLExpOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLExpm1Op definitions //===----------------------------------------------------------------------===// namespace detail { CLExpm1OpGenericAdaptorBase::CLExpm1OpGenericAdaptorBase(CLExpm1Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLExpm1OpAdaptor::CLExpm1OpAdaptor(CLExpm1Op op) : CLExpm1OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLExpm1OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLExpm1Op::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 CLExpm1Op::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 CLExpm1Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLExpm1Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLExpm1Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLExpm1Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLExpm1Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLExpm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLExpm1Op CLExpm1Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpm1Op CLExpm1Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLExpm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLExpm1Op::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); } CLExpm1Op CLExpm1Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpm1Op CLExpm1Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLExpm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLExpm1Op CLExpm1Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpm1Op CLExpm1Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLExpm1Op::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); } CLExpm1Op CLExpm1Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpm1Op CLExpm1Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLExpm1Op::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(CLExpm1Op::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)."); } } CLExpm1Op CLExpm1Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpm1Op CLExpm1Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLExpm1Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLExpm1Op CLExpm1Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpm1Op CLExpm1Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLExpm1Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLExpm1Op::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)."); } } CLExpm1Op CLExpm1Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLExpm1Op CLExpm1Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLExpm1Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLExpm1Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLExpm1Op::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 CLExpm1Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLExpm1Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLExpm1Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLExpm1Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLFAbsOp definitions //===----------------------------------------------------------------------===// namespace detail { CLFAbsOpGenericAdaptorBase::CLFAbsOpGenericAdaptorBase(CLFAbsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLFAbsOpAdaptor::CLFAbsOpAdaptor(CLFAbsOp op) : CLFAbsOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLFAbsOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLFAbsOp::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 CLFAbsOp::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 CLFAbsOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLFAbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLFAbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLFAbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLFAbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLFAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLFAbsOp CLFAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFAbsOp CLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLFAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFAbsOp::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); } CLFAbsOp CLFAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFAbsOp CLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLFAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLFAbsOp CLFAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFAbsOp CLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLFAbsOp::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); } CLFAbsOp CLFAbsOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFAbsOp CLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLFAbsOp::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(CLFAbsOp::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)."); } } CLFAbsOp CLFAbsOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFAbsOp CLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLFAbsOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLFAbsOp CLFAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFAbsOp CLFAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLFAbsOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFAbsOp::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)."); } } CLFAbsOp CLFAbsOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFAbsOp CLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLFAbsOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLFAbsOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLFAbsOp::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 CLFAbsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLFAbsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLFAbsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLFAbsOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLFMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { CLFMaxOpGenericAdaptorBase::CLFMaxOpGenericAdaptorBase(CLFMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLFMaxOpAdaptor::CLFMaxOpAdaptor(CLFMaxOp op) : CLFMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLFMaxOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLFMaxOp::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 CLFMaxOp::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 CLFMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLFMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLFMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLFMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLFMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } CLFMaxOp CLFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMaxOp CLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void CLFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFMaxOp::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); } CLFMaxOp CLFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMaxOp CLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void CLFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLFMaxOp CLFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMaxOp CLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void CLFMaxOp::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); } CLFMaxOp CLFMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMaxOp CLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLFMaxOp::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(CLFMaxOp::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)."); } } CLFMaxOp CLFMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMaxOp CLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLFMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLFMaxOp CLFMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMaxOp CLFMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLFMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFMaxOp::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)."); } } CLFMaxOp CLFMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMaxOp CLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLFMaxOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLFMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLFMaxOp::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 CLFMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLFMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLFMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLFMaxOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLFMinOp definitions //===----------------------------------------------------------------------===// namespace detail { CLFMinOpGenericAdaptorBase::CLFMinOpGenericAdaptorBase(CLFMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLFMinOpAdaptor::CLFMinOpAdaptor(CLFMinOp op) : CLFMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLFMinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLFMinOp::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 CLFMinOp::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 CLFMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLFMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLFMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLFMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLFMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } CLFMinOp CLFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMinOp CLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void CLFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFMinOp::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); } CLFMinOp CLFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMinOp CLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void CLFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLFMinOp CLFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMinOp CLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void CLFMinOp::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); } CLFMinOp CLFMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMinOp CLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLFMinOp::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(CLFMinOp::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)."); } } CLFMinOp CLFMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMinOp CLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLFMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLFMinOp CLFMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMinOp CLFMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLFMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFMinOp::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)."); } } CLFMinOp CLFMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFMinOp CLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLFMinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLFMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLFMinOp::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 CLFMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLFMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLFMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLFMinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLFloorOp definitions //===----------------------------------------------------------------------===// namespace detail { CLFloorOpGenericAdaptorBase::CLFloorOpGenericAdaptorBase(CLFloorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLFloorOpAdaptor::CLFloorOpAdaptor(CLFloorOp op) : CLFloorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLFloorOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLFloorOp::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 CLFloorOp::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 CLFloorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLFloorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLFloorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLFloorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLFloorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLFloorOp CLFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFloorOp CLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFloorOp::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); } CLFloorOp CLFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFloorOp CLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLFloorOp CLFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFloorOp CLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLFloorOp::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); } CLFloorOp CLFloorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFloorOp CLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLFloorOp::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(CLFloorOp::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)."); } } CLFloorOp CLFloorOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFloorOp CLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLFloorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLFloorOp CLFloorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFloorOp CLFloorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLFloorOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFloorOp::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)."); } } CLFloorOp CLFloorOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFloorOp CLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLFloorOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLFloorOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLFloorOp::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 CLFloorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLFloorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLFloorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLFloorOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLFmaOp definitions //===----------------------------------------------------------------------===// namespace detail { CLFmaOpGenericAdaptorBase::CLFmaOpGenericAdaptorBase(CLFmaOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLFmaOpAdaptor::CLFmaOpAdaptor(CLFmaOp op) : CLFmaOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLFmaOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLFmaOp::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 CLFmaOp::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 CLFmaOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLFmaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLFmaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLFmaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLFmaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLFmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); odsState.addTypes(result); } CLFmaOp CLFmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFmaOp CLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(y), std::forward(z)); } void CLFmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFmaOp::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); } CLFmaOp CLFmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFmaOp CLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(x), std::forward(y), std::forward(z)); } void CLFmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLFmaOp CLFmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFmaOp CLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); } void CLFmaOp::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); } CLFmaOp CLFmaOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFmaOp CLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLFmaOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFmaOp::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)."); } } CLFmaOp CLFmaOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFmaOp CLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLFmaOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLFmaOp CLFmaOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFmaOp CLFmaOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLFmaOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLFmaOp::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)."); } } CLFmaOp CLFmaOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLFmaOp CLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLFmaOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLFmaOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLFmaOp::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 CLFmaOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLFmaOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLFmaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLFmaOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLLdexpOp definitions //===----------------------------------------------------------------------===// namespace detail { CLLdexpOpGenericAdaptorBase::CLLdexpOpGenericAdaptorBase(CLLdexpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLLdexpOpAdaptor::CLLdexpOpAdaptor(CLLdexpOp op) : CLLdexpOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLLdexpOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLLdexpOp::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 CLLdexpOp::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 CLLdexpOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLLdexpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLLdexpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLLdexpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLLdexpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLLdexpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value exp) { odsState.addOperands(x); odsState.addOperands(exp); odsState.addTypes(y); } CLLdexpOp CLLdexpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type y, ::mlir::Value x, ::mlir::Value exp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(y), std::forward(x), std::forward(exp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLdexpOp CLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type y, ::mlir::Value x, ::mlir::Value exp) { return create(builder, builder.getLoc(), std::forward(y), std::forward(x), std::forward(exp)); } void CLLdexpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value exp) { odsState.addOperands(x); odsState.addOperands(exp); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLdexpOp::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); } CLLdexpOp CLLdexpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value exp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(x), std::forward(exp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLdexpOp CLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value exp) { return create(builder, builder.getLoc(), std::forward(x), std::forward(exp)); } void CLLdexpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value exp) { odsState.addOperands(x); odsState.addOperands(exp); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLLdexpOp CLLdexpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value exp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(exp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLdexpOp CLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value exp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(exp)); } void CLLdexpOp::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); } CLLdexpOp CLLdexpOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLdexpOp CLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLLdexpOp::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(CLLdexpOp::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)."); } } CLLdexpOp CLLdexpOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLdexpOp CLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLLdexpOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLLdexpOp CLLdexpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLdexpOp CLLdexpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLLdexpOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLdexpOp::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)."); } } CLLdexpOp CLLdexpOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLdexpOp CLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLLdexpOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, y} have same type"); return ::mlir::success(); } ::llvm::LogicalResult CLLdexpOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult CLLdexpOp::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 CLLdexpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand xRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(&xRawOperand, 1); ::llvm::SMLoc xOperandsLoc; (void)xOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand expRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> expOperands(&expRawOperand, 1); ::llvm::SMLoc expOperandsLoc; (void)expOperandsLoc; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); ::mlir::Type expRawType{}; ::llvm::ArrayRef<::mlir::Type> expTypes(&expRawType, 1); ::mlir::Type yRawType{}; ::llvm::ArrayRef<::mlir::Type> yTypes(&yRawType, 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(); } xOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(xRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); expOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(expRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); xRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); expRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); yRawType = type; } result.addTypes(yTypes); if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(expOperands, expTypes, expOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLLdexpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getX(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getExp(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getExp().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getY().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void CLLdexpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLLdexpOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLLog10Op definitions //===----------------------------------------------------------------------===// namespace detail { CLLog10OpGenericAdaptorBase::CLLog10OpGenericAdaptorBase(CLLog10Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLLog10OpAdaptor::CLLog10OpAdaptor(CLLog10Op op) : CLLog10OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLLog10OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLLog10Op::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 CLLog10Op::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 CLLog10Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLLog10Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLLog10Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLLog10Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLLog10Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLLog10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLLog10Op CLLog10Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog10Op CLLog10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLLog10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLog10Op::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); } CLLog10Op CLLog10Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog10Op CLLog10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLLog10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLLog10Op CLLog10Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog10Op CLLog10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLLog10Op::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); } CLLog10Op CLLog10Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog10Op CLLog10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLLog10Op::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(CLLog10Op::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)."); } } CLLog10Op CLLog10Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog10Op CLLog10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLLog10Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLLog10Op CLLog10Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog10Op CLLog10Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLLog10Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLog10Op::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)."); } } CLLog10Op CLLog10Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog10Op CLLog10Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLLog10Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLLog10Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLLog10Op::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 CLLog10Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLLog10Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLLog10Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLLog10Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLLog1pOp definitions //===----------------------------------------------------------------------===// namespace detail { CLLog1pOpGenericAdaptorBase::CLLog1pOpGenericAdaptorBase(CLLog1pOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLLog1pOpAdaptor::CLLog1pOpAdaptor(CLLog1pOp op) : CLLog1pOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLLog1pOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLLog1pOp::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 CLLog1pOp::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 CLLog1pOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLLog1pOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLLog1pOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLLog1pOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLLog1pOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLLog1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLLog1pOp CLLog1pOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog1pOp CLLog1pOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLLog1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLog1pOp::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); } CLLog1pOp CLLog1pOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog1pOp CLLog1pOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLLog1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLLog1pOp CLLog1pOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog1pOp CLLog1pOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLLog1pOp::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); } CLLog1pOp CLLog1pOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog1pOp CLLog1pOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLLog1pOp::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(CLLog1pOp::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)."); } } CLLog1pOp CLLog1pOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog1pOp CLLog1pOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLLog1pOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLLog1pOp CLLog1pOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog1pOp CLLog1pOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLLog1pOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLog1pOp::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)."); } } CLLog1pOp CLLog1pOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog1pOp CLLog1pOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLLog1pOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLLog1pOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLLog1pOp::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 CLLog1pOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLLog1pOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLLog1pOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLLog1pOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLLog2Op definitions //===----------------------------------------------------------------------===// namespace detail { CLLog2OpGenericAdaptorBase::CLLog2OpGenericAdaptorBase(CLLog2Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLLog2OpAdaptor::CLLog2OpAdaptor(CLLog2Op op) : CLLog2OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLLog2OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLLog2Op::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 CLLog2Op::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 CLLog2Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLLog2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLLog2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLLog2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLLog2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLLog2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLLog2Op CLLog2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog2Op CLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLLog2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLog2Op::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); } CLLog2Op CLLog2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog2Op CLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLLog2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLLog2Op CLLog2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog2Op CLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLLog2Op::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); } CLLog2Op CLLog2Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog2Op CLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLLog2Op::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(CLLog2Op::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)."); } } CLLog2Op CLLog2Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog2Op CLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLLog2Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLLog2Op CLLog2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog2Op CLLog2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLLog2Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLog2Op::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)."); } } CLLog2Op CLLog2Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLog2Op CLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLLog2Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLLog2Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLLog2Op::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 CLLog2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLLog2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLLog2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLLog2Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLLogOp definitions //===----------------------------------------------------------------------===// namespace detail { CLLogOpGenericAdaptorBase::CLLogOpGenericAdaptorBase(CLLogOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLLogOpAdaptor::CLLogOpAdaptor(CLLogOp op) : CLLogOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLLogOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLLogOp::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 CLLogOp::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 CLLogOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLLogOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLLogOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLLogOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLLogOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLLogOp CLLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLogOp CLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLogOp::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); } CLLogOp CLLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLogOp CLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLLogOp CLLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLogOp CLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLLogOp::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); } CLLogOp CLLogOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLogOp CLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLLogOp::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(CLLogOp::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)."); } } CLLogOp CLLogOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLogOp CLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLLogOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLLogOp CLLogOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLogOp CLLogOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLLogOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLLogOp::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)."); } } CLLogOp CLLogOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLLogOp CLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLLogOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLLogOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLLogOp::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 CLLogOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLLogOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLLogOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLLogOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLMixOp definitions //===----------------------------------------------------------------------===// namespace detail { CLMixOpGenericAdaptorBase::CLMixOpGenericAdaptorBase(CLMixOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLMixOpAdaptor::CLMixOpAdaptor(CLMixOp op) : CLMixOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLMixOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLMixOp::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 CLMixOp::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 CLMixOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLMixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLMixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLMixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLMixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLMixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); odsState.addTypes(result); } CLMixOp CLMixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLMixOp CLMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(y), std::forward(z)); } void CLMixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLMixOp::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); } CLMixOp CLMixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLMixOp CLMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(x), std::forward(y), std::forward(z)); } void CLMixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLMixOp CLMixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLMixOp CLMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); } void CLMixOp::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); } CLMixOp CLMixOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLMixOp CLMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLMixOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLMixOp::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)."); } } CLMixOp CLMixOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLMixOp CLMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLMixOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLMixOp CLMixOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLMixOp CLMixOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLMixOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLMixOp::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)."); } } CLMixOp CLMixOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLMixOp CLMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLMixOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLMixOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLMixOp::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 CLMixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLMixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLMixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLMixOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLPowOp definitions //===----------------------------------------------------------------------===// namespace detail { CLPowOpGenericAdaptorBase::CLPowOpGenericAdaptorBase(CLPowOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLPowOpAdaptor::CLPowOpAdaptor(CLPowOp op) : CLPowOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLPowOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLPowOp::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 CLPowOp::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 CLPowOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLPowOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLPowOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLPowOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLPowOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLPowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } CLPowOp CLPowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPowOp CLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void CLPowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLPowOp::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); } CLPowOp CLPowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPowOp CLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void CLPowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLPowOp CLPowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPowOp CLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void CLPowOp::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); } CLPowOp CLPowOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPowOp CLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLPowOp::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(CLPowOp::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)."); } } CLPowOp CLPowOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPowOp CLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLPowOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLPowOp CLPowOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPowOp CLPowOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLPowOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLPowOp::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)."); } } CLPowOp CLPowOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPowOp CLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLPowOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLPowOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLPowOp::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 CLPowOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLPowOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLPowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLPowOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLPownOp definitions //===----------------------------------------------------------------------===// namespace detail { CLPownOpGenericAdaptorBase::CLPownOpGenericAdaptorBase(CLPownOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLPownOpAdaptor::CLPownOpAdaptor(CLPownOp op) : CLPownOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLPownOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLPownOp::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 CLPownOp::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 CLPownOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLPownOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLPownOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLPownOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLPownOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLPownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y) { odsState.addOperands(x); odsState.addOperands(y); odsState.addTypes(result); } CLPownOp CLPownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(y)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPownOp CLPownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(y)); } void CLPownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value y) { odsState.addOperands(x); odsState.addOperands(y); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLPownOp::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); } CLPownOp CLPownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value y) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(x), std::forward(y)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPownOp CLPownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value y) { return create(builder, builder.getLoc(), std::forward(x), std::forward(y)); } void CLPownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y) { odsState.addOperands(x); odsState.addOperands(y); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLPownOp CLPownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(y)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPownOp CLPownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(y)); } void CLPownOp::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); } CLPownOp CLPownOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPownOp CLPownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLPownOp::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(CLPownOp::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)."); } } CLPownOp CLPownOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPownOp CLPownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLPownOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLPownOp CLPownOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPownOp CLPownOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLPownOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLPownOp::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)."); } } CLPownOp CLPownOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPownOp CLPownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLPownOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult CLPownOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult CLPownOp::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 CLPownOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand xRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(&xRawOperand, 1); ::llvm::SMLoc xOperandsLoc; (void)xOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand yRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> yOperands(&yRawOperand, 1); ::llvm::SMLoc yOperandsLoc; (void)yOperandsLoc; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); ::mlir::Type yRawType{}; ::llvm::ArrayRef<::mlir::Type> yTypes(&yRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } xOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(xRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); yOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(yRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); xRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); yRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(yOperands, yTypes, yOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLPownOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getX(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getY(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getY().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 CLPownOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLPownOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLPrintfOp definitions //===----------------------------------------------------------------------===// namespace detail { CLPrintfOpGenericAdaptorBase::CLPrintfOpGenericAdaptorBase(CLPrintfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair CLPrintfOpGenericAdaptorBase::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 CLPrintfOpAdaptor::CLPrintfOpAdaptor(CLPrintfOp op) : CLPrintfOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLPrintfOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair CLPrintfOp::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 CLPrintfOp::getArgumentsMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult CLPrintfOp::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 CLPrintfOp::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 CLPrintfOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLPrintfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLPrintfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLPrintfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLPrintfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLPrintfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value format, ::mlir::ValueRange arguments) { odsState.addOperands(format); odsState.addOperands(arguments); odsState.addTypes(result); } CLPrintfOp CLPrintfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value format, ::mlir::ValueRange arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(format), std::forward(arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPrintfOp CLPrintfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value format, ::mlir::ValueRange arguments) { return create(builder, builder.getLoc(), std::forward(result), std::forward(format), std::forward(arguments)); } void CLPrintfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value format, ::mlir::ValueRange arguments) { odsState.addOperands(format); odsState.addOperands(arguments); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLPrintfOp CLPrintfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value format, ::mlir::ValueRange arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(format), std::forward(arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPrintfOp CLPrintfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value format, ::mlir::ValueRange arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(format), std::forward(arguments)); } void CLPrintfOp::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); } CLPrintfOp CLPrintfOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPrintfOp CLPrintfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLPrintfOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLPrintfOp CLPrintfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLPrintfOp CLPrintfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLPrintfOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLPrintfOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult CLPrintfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand formatRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> formatOperands(&formatRawOperand, 1); ::llvm::SMLoc formatOperandsLoc; (void)formatOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argumentsOperands; ::llvm::SMLoc argumentsOperandsLoc; (void)argumentsOperandsLoc; ::mlir::Type formatRawType{}; ::llvm::ArrayRef<::mlir::Type> formatTypes(&formatRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> argumentsTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); formatOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(formatRawOperand)) return ::mlir::failure(); argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(argumentsOperands)) return ::mlir::failure(); if (!argumentsOperands.empty()) { } { 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(); formatRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseTypeList(argumentsTypes)) return ::mlir::failure(); } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(formatOperands, formatTypes, formatOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(argumentsOperands, argumentsTypes, argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLPrintfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getFormat(); if (!getArguments().empty()) { _odsPrinter << ' '; _odsPrinter << getArguments(); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getFormat().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getArguments().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLPrintfOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLRintOp definitions //===----------------------------------------------------------------------===// namespace detail { CLRintOpGenericAdaptorBase::CLRintOpGenericAdaptorBase(CLRintOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLRintOpAdaptor::CLRintOpAdaptor(CLRintOp op) : CLRintOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLRintOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLRintOp::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 CLRintOp::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 CLRintOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLRintOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLRintOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLRintOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLRintOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLRintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLRintOp CLRintOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRintOp CLRintOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLRintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLRintOp::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); } CLRintOp CLRintOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRintOp CLRintOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLRintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLRintOp CLRintOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRintOp CLRintOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLRintOp::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); } CLRintOp CLRintOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRintOp CLRintOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLRintOp::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(CLRintOp::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)."); } } CLRintOp CLRintOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRintOp CLRintOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLRintOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLRintOp CLRintOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRintOp CLRintOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLRintOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLRintOp::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)."); } } CLRintOp CLRintOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRintOp CLRintOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLRintOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLRintOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLRintOp::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 CLRintOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLRintOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLRintOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLRintOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLRootnOp definitions //===----------------------------------------------------------------------===// namespace detail { CLRootnOpGenericAdaptorBase::CLRootnOpGenericAdaptorBase(CLRootnOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLRootnOpAdaptor::CLRootnOpAdaptor(CLRootnOp op) : CLRootnOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLRootnOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLRootnOp::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 CLRootnOp::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 CLRootnOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLRootnOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLRootnOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLRootnOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLRootnOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLRootnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value n) { odsState.addOperands(x); odsState.addOperands(n); odsState.addTypes(result); } CLRootnOp CLRootnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value n) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(n)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRootnOp CLRootnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value n) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(n)); } void CLRootnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value n) { odsState.addOperands(x); odsState.addOperands(n); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLRootnOp::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); } CLRootnOp CLRootnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value n) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(x), std::forward(n)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRootnOp CLRootnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value n) { return create(builder, builder.getLoc(), std::forward(x), std::forward(n)); } void CLRootnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value n) { odsState.addOperands(x); odsState.addOperands(n); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLRootnOp CLRootnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value n) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(n)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRootnOp CLRootnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value n) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(n)); } void CLRootnOp::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); } CLRootnOp CLRootnOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRootnOp CLRootnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLRootnOp::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(CLRootnOp::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)."); } } CLRootnOp CLRootnOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRootnOp CLRootnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLRootnOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLRootnOp CLRootnOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRootnOp CLRootnOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLRootnOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLRootnOp::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)."); } } CLRootnOp CLRootnOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRootnOp CLRootnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLRootnOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult CLRootnOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult CLRootnOp::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 CLRootnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand xRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(&xRawOperand, 1); ::llvm::SMLoc xOperandsLoc; (void)xOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand nRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> nOperands(&nRawOperand, 1); ::llvm::SMLoc nOperandsLoc; (void)nOperandsLoc; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); ::mlir::Type nRawType{}; ::llvm::ArrayRef<::mlir::Type> nTypes(&nRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } xOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(xRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); nOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(nRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); xRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); nRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(nOperands, nTypes, nOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLRootnOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getX(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getN(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getN().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 CLRootnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLRootnOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLRoundOp definitions //===----------------------------------------------------------------------===// namespace detail { CLRoundOpGenericAdaptorBase::CLRoundOpGenericAdaptorBase(CLRoundOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLRoundOpAdaptor::CLRoundOpAdaptor(CLRoundOp op) : CLRoundOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLRoundOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLRoundOp::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 CLRoundOp::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 CLRoundOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLRoundOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLRoundOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLRoundOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLRoundOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLRoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLRoundOp CLRoundOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRoundOp CLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLRoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLRoundOp::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); } CLRoundOp CLRoundOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRoundOp CLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLRoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLRoundOp CLRoundOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRoundOp CLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLRoundOp::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); } CLRoundOp CLRoundOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRoundOp CLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLRoundOp::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(CLRoundOp::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)."); } } CLRoundOp CLRoundOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRoundOp CLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLRoundOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLRoundOp CLRoundOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRoundOp CLRoundOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLRoundOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLRoundOp::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)."); } } CLRoundOp CLRoundOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRoundOp CLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLRoundOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLRoundOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLRoundOp::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 CLRoundOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLRoundOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLRoundOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLRoundOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLRsqrtOp definitions //===----------------------------------------------------------------------===// namespace detail { CLRsqrtOpGenericAdaptorBase::CLRsqrtOpGenericAdaptorBase(CLRsqrtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLRsqrtOpAdaptor::CLRsqrtOpAdaptor(CLRsqrtOp op) : CLRsqrtOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLRsqrtOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLRsqrtOp::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 CLRsqrtOp::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 CLRsqrtOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLRsqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLRsqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLRsqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLRsqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLRsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLRsqrtOp CLRsqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRsqrtOp CLRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLRsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLRsqrtOp::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); } CLRsqrtOp CLRsqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRsqrtOp CLRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLRsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLRsqrtOp CLRsqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRsqrtOp CLRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLRsqrtOp::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); } CLRsqrtOp CLRsqrtOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRsqrtOp CLRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLRsqrtOp::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(CLRsqrtOp::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)."); } } CLRsqrtOp CLRsqrtOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRsqrtOp CLRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLRsqrtOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLRsqrtOp CLRsqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRsqrtOp CLRsqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLRsqrtOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLRsqrtOp::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)."); } } CLRsqrtOp CLRsqrtOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLRsqrtOp CLRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLRsqrtOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLRsqrtOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLRsqrtOp::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 CLRsqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLRsqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLRsqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLRsqrtOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLSAbsOp definitions //===----------------------------------------------------------------------===// namespace detail { CLSAbsOpGenericAdaptorBase::CLSAbsOpGenericAdaptorBase(CLSAbsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLSAbsOpAdaptor::CLSAbsOpAdaptor(CLSAbsOp op) : CLSAbsOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLSAbsOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLSAbsOp::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 CLSAbsOp::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 CLSAbsOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLSAbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLSAbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLSAbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLSAbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLSAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLSAbsOp CLSAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSAbsOp CLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLSAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSAbsOp::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); } CLSAbsOp CLSAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSAbsOp CLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLSAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLSAbsOp CLSAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSAbsOp CLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLSAbsOp::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); } CLSAbsOp CLSAbsOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSAbsOp CLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLSAbsOp::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(CLSAbsOp::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)."); } } CLSAbsOp CLSAbsOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSAbsOp CLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLSAbsOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLSAbsOp CLSAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSAbsOp CLSAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLSAbsOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSAbsOp::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)."); } } CLSAbsOp CLSAbsOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSAbsOp CLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLSAbsOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLSAbsOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLSAbsOp::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 CLSAbsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLSAbsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLSAbsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLSAbsOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLSMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { CLSMaxOpGenericAdaptorBase::CLSMaxOpGenericAdaptorBase(CLSMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLSMaxOpAdaptor::CLSMaxOpAdaptor(CLSMaxOp op) : CLSMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLSMaxOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLSMaxOp::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 CLSMaxOp::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 CLSMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLSMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLSMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLSMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLSMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } CLSMaxOp CLSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMaxOp CLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void CLSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSMaxOp::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); } CLSMaxOp CLSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMaxOp CLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void CLSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLSMaxOp CLSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMaxOp CLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void CLSMaxOp::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); } CLSMaxOp CLSMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMaxOp CLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLSMaxOp::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(CLSMaxOp::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)."); } } CLSMaxOp CLSMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMaxOp CLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLSMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLSMaxOp CLSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMaxOp CLSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLSMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSMaxOp::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)."); } } CLSMaxOp CLSMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMaxOp CLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLSMaxOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLSMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLSMaxOp::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 CLSMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLSMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLSMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLSMaxOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLSMinOp definitions //===----------------------------------------------------------------------===// namespace detail { CLSMinOpGenericAdaptorBase::CLSMinOpGenericAdaptorBase(CLSMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLSMinOpAdaptor::CLSMinOpAdaptor(CLSMinOp op) : CLSMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLSMinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLSMinOp::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 CLSMinOp::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 CLSMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLSMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLSMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLSMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLSMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } CLSMinOp CLSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMinOp CLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void CLSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSMinOp::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); } CLSMinOp CLSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMinOp CLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void CLSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLSMinOp CLSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMinOp CLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void CLSMinOp::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); } CLSMinOp CLSMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMinOp CLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLSMinOp::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(CLSMinOp::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)."); } } CLSMinOp CLSMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMinOp CLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLSMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLSMinOp CLSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMinOp CLSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLSMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSMinOp::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)."); } } CLSMinOp CLSMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSMinOp CLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLSMinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLSMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLSMinOp::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 CLSMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLSMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLSMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLSMinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLSinOp definitions //===----------------------------------------------------------------------===// namespace detail { CLSinOpGenericAdaptorBase::CLSinOpGenericAdaptorBase(CLSinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLSinOpAdaptor::CLSinOpAdaptor(CLSinOp op) : CLSinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLSinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLSinOp::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 CLSinOp::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 CLSinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLSinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLSinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLSinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLSinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLSinOp CLSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinOp CLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSinOp::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); } CLSinOp CLSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinOp CLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLSinOp CLSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinOp CLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLSinOp::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); } CLSinOp CLSinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinOp CLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLSinOp::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(CLSinOp::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)."); } } CLSinOp CLSinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinOp CLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLSinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLSinOp CLSinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinOp CLSinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLSinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSinOp::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)."); } } CLSinOp CLSinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinOp CLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLSinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLSinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLSinOp::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 CLSinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLSinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLSinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLSinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLSinhOp definitions //===----------------------------------------------------------------------===// namespace detail { CLSinhOpGenericAdaptorBase::CLSinhOpGenericAdaptorBase(CLSinhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLSinhOpAdaptor::CLSinhOpAdaptor(CLSinhOp op) : CLSinhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLSinhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLSinhOp::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 CLSinhOp::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 CLSinhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLSinhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLSinhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLSinhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLSinhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLSinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLSinhOp CLSinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinhOp CLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLSinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSinhOp::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); } CLSinhOp CLSinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinhOp CLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLSinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLSinhOp CLSinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinhOp CLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLSinhOp::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); } CLSinhOp CLSinhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinhOp CLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLSinhOp::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(CLSinhOp::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)."); } } CLSinhOp CLSinhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinhOp CLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLSinhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLSinhOp CLSinhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinhOp CLSinhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLSinhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSinhOp::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)."); } } CLSinhOp CLSinhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSinhOp CLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLSinhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLSinhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLSinhOp::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 CLSinhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLSinhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLSinhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLSinhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLSqrtOp definitions //===----------------------------------------------------------------------===// namespace detail { CLSqrtOpGenericAdaptorBase::CLSqrtOpGenericAdaptorBase(CLSqrtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLSqrtOpAdaptor::CLSqrtOpAdaptor(CLSqrtOp op) : CLSqrtOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLSqrtOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLSqrtOp::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 CLSqrtOp::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 CLSqrtOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLSqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLSqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLSqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLSqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLSqrtOp CLSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSqrtOp CLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSqrtOp::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); } CLSqrtOp CLSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSqrtOp CLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLSqrtOp CLSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSqrtOp CLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLSqrtOp::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); } CLSqrtOp CLSqrtOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSqrtOp CLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLSqrtOp::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(CLSqrtOp::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)."); } } CLSqrtOp CLSqrtOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSqrtOp CLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLSqrtOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLSqrtOp CLSqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSqrtOp CLSqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLSqrtOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLSqrtOp::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)."); } } CLSqrtOp CLSqrtOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLSqrtOp CLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLSqrtOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLSqrtOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLSqrtOp::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 CLSqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLSqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLSqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLSqrtOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLTanOp definitions //===----------------------------------------------------------------------===// namespace detail { CLTanOpGenericAdaptorBase::CLTanOpGenericAdaptorBase(CLTanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLTanOpAdaptor::CLTanOpAdaptor(CLTanOp op) : CLTanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLTanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLTanOp::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 CLTanOp::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 CLTanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLTanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLTanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLTanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLTanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLTanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLTanOp CLTanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanOp CLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLTanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLTanOp::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); } CLTanOp CLTanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanOp CLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLTanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLTanOp CLTanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanOp CLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLTanOp::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); } CLTanOp CLTanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanOp CLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLTanOp::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(CLTanOp::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)."); } } CLTanOp CLTanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanOp CLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLTanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLTanOp CLTanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanOp CLTanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLTanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLTanOp::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)."); } } CLTanOp CLTanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanOp CLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLTanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLTanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLTanOp::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 CLTanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLTanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLTanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLTanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLTanhOp definitions //===----------------------------------------------------------------------===// namespace detail { CLTanhOpGenericAdaptorBase::CLTanhOpGenericAdaptorBase(CLTanhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLTanhOpAdaptor::CLTanhOpAdaptor(CLTanhOp op) : CLTanhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLTanhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLTanhOp::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 CLTanhOp::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 CLTanhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLTanhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLTanhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLTanhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLTanhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLTanhOp CLTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanhOp CLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLTanhOp::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); } CLTanhOp CLTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanhOp CLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLTanhOp CLTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanhOp CLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLTanhOp::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); } CLTanhOp CLTanhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanhOp CLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLTanhOp::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(CLTanhOp::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)."); } } CLTanhOp CLTanhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanhOp CLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLTanhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLTanhOp CLTanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanhOp CLTanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLTanhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLTanhOp::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)."); } } CLTanhOp CLTanhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTanhOp CLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLTanhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLTanhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLTanhOp::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 CLTanhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLTanhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLTanhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLTanhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLTruncOp definitions //===----------------------------------------------------------------------===// namespace detail { CLTruncOpGenericAdaptorBase::CLTruncOpGenericAdaptorBase(CLTruncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLTruncOpAdaptor::CLTruncOpAdaptor(CLTruncOp op) : CLTruncOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLTruncOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLTruncOp::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 CLTruncOp::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 CLTruncOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLTruncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLTruncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLTruncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLTruncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } CLTruncOp CLTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTruncOp CLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void CLTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLTruncOp::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); } CLTruncOp CLTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTruncOp CLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void CLTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLTruncOp CLTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTruncOp CLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void CLTruncOp::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); } CLTruncOp CLTruncOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTruncOp CLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLTruncOp::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(CLTruncOp::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)."); } } CLTruncOp CLTruncOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTruncOp CLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLTruncOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLTruncOp CLTruncOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTruncOp CLTruncOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLTruncOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLTruncOp::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)."); } } CLTruncOp CLTruncOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLTruncOp CLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLTruncOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLTruncOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLTruncOp::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 CLTruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLTruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void CLTruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLTruncOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLUMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { CLUMaxOpGenericAdaptorBase::CLUMaxOpGenericAdaptorBase(CLUMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLUMaxOpAdaptor::CLUMaxOpAdaptor(CLUMaxOp op) : CLUMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLUMaxOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLUMaxOp::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 CLUMaxOp::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 CLUMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLUMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLUMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLUMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLUMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } CLUMaxOp CLUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMaxOp CLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void CLUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLUMaxOp::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); } CLUMaxOp CLUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMaxOp CLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void CLUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLUMaxOp CLUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMaxOp CLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void CLUMaxOp::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); } CLUMaxOp CLUMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMaxOp CLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLUMaxOp::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(CLUMaxOp::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)."); } } CLUMaxOp CLUMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMaxOp CLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLUMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLUMaxOp CLUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMaxOp CLUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLUMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLUMaxOp::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)."); } } CLUMaxOp CLUMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMaxOp CLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLUMaxOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLUMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLUMaxOp::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 CLUMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLUMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLUMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLUMaxOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CLUMinOp definitions //===----------------------------------------------------------------------===// namespace detail { CLUMinOpGenericAdaptorBase::CLUMinOpGenericAdaptorBase(CLUMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail CLUMinOpAdaptor::CLUMinOpAdaptor(CLUMinOp op) : CLUMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CLUMinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult CLUMinOp::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 CLUMinOp::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 CLUMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CLUMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CLUMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CLUMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CLUMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CLUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } CLUMinOp CLUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMinOp CLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void CLUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLUMinOp::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); } CLUMinOp CLUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMinOp CLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void CLUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CLUMinOp CLUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMinOp CLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void CLUMinOp::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); } CLUMinOp CLUMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMinOp CLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CLUMinOp::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(CLUMinOp::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)."); } } CLUMinOp CLUMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMinOp CLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void CLUMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CLUMinOp CLUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMinOp CLUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void CLUMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(CLUMinOp::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)."); } } CLUMinOp CLUMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CLUMinOp CLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CLUMinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CLUMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult CLUMinOp::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 CLUMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CLUMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 CLUMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CLUMinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CompositeConstructOp definitions //===----------------------------------------------------------------------===// namespace detail { CompositeConstructOpGenericAdaptorBase::CompositeConstructOpGenericAdaptorBase(CompositeConstructOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair CompositeConstructOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {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 - 0) / 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 CompositeConstructOpAdaptor::CompositeConstructOpAdaptor(CompositeConstructOp op) : CompositeConstructOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CompositeConstructOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair CompositeConstructOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {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() - 0) / 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 CompositeConstructOp::getConstituentsMutable() { auto range = getODSOperandIndexAndLength(0); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult CompositeConstructOp::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 CompositeConstructOp::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 CompositeConstructOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional CompositeConstructOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void CompositeConstructOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void CompositeConstructOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult CompositeConstructOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void CompositeConstructOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange constituents) { odsState.addOperands(constituents); odsState.addTypes(result); } CompositeConstructOp CompositeConstructOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange constituents) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(constituents)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeConstructOp CompositeConstructOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange constituents) { return create(builder, builder.getLoc(), std::forward(result), std::forward(constituents)); } void CompositeConstructOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { odsState.addOperands(operands); odsState.addAttributes(attributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CompositeConstructOp CompositeConstructOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeConstructOp CompositeConstructOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CompositeConstructOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { odsState.addOperands(operands); odsState.useProperties(const_cast(properties)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CompositeConstructOp CompositeConstructOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeConstructOp CompositeConstructOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CompositeConstructOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*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_SPIRVOps11(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CompositeConstructOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult CompositeConstructOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> constituentsOperands; ::llvm::SMLoc constituentsOperandsLoc; (void)constituentsOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); constituentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(constituentsOperands)) 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.parseLParen()) return ::mlir::failure(); if (parser.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseRParen()) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(constituentsOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void CompositeConstructOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getConstituents(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' ' << "("; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ")"; _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void CompositeConstructOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CompositeConstructOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CompositeExtractOp definitions //===----------------------------------------------------------------------===// namespace detail { CompositeExtractOpGenericAdaptorBase::CompositeExtractOpGenericAdaptorBase(CompositeExtractOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::ArrayAttr CompositeExtractOpGenericAdaptorBase::getIndices() { auto attr = getIndicesAttr(); return attr; } } // namespace detail CompositeExtractOpAdaptor::CompositeExtractOpAdaptor(CompositeExtractOp op) : CompositeExtractOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CompositeExtractOpAdaptor::verify(::mlir::Location loc) { auto tblgen_indices = getProperties().indices; (void)tblgen_indices; if (!tblgen_indices) return emitError(loc, "'spirv.CompositeExtract' op requires attribute 'indices'"); if (tblgen_indices && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_indices))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_indices), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) return emitError(loc, "'spirv.CompositeExtract' op attribute 'indices' failed to satisfy constraint: 32-bit integer array attribute"); return ::mlir::success(); } ::llvm::LogicalResult CompositeExtractOp::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.indices; auto attr = dict.get("indices"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `indices` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute CompositeExtractOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.indices; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("indices", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code CompositeExtractOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.indices.getAsOpaquePointer())); } std::optional CompositeExtractOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "indices") return prop.indices; return std::nullopt; } void CompositeExtractOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "indices") { prop.indices = ::llvm::dyn_cast_or_null>(value); return; } } void CompositeExtractOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.indices) attrs.append("indices", prop.indices); } ::llvm::LogicalResult CompositeExtractOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getIndicesAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(attr, "indices", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult CompositeExtractOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.indices))) return ::mlir::failure(); return ::mlir::success(); } void CompositeExtractOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.indices); } ::mlir::ArrayAttr CompositeExtractOp::getIndices() { auto attr = getIndicesAttr(); return attr; } CompositeExtractOp CompositeExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value composite, ArrayRef indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(composite), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeExtractOp CompositeExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, Value composite, ArrayRef indices) { return create(builder, builder.getLoc(), std::forward(composite), std::forward(indices)); } void CompositeExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type component, ::mlir::Value composite, ::mlir::ArrayAttr indices) { odsState.addOperands(composite); odsState.getOrAddProperties().indices = indices; odsState.addTypes(component); } CompositeExtractOp CompositeExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type component, ::mlir::Value composite, ::mlir::ArrayAttr indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(component), std::forward(composite), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeExtractOp CompositeExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type component, ::mlir::Value composite, ::mlir::ArrayAttr indices) { return create(builder, builder.getLoc(), std::forward(component), std::forward(composite), std::forward(indices)); } void CompositeExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value composite, ::mlir::ArrayAttr indices) { odsState.addOperands(composite); odsState.getOrAddProperties().indices = indices; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CompositeExtractOp CompositeExtractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value composite, ::mlir::ArrayAttr indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(composite), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeExtractOp CompositeExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value composite, ::mlir::ArrayAttr indices) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(composite), std::forward(indices)); } void CompositeExtractOp::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(); ::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."); } } CompositeExtractOp CompositeExtractOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeExtractOp CompositeExtractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CompositeExtractOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CompositeExtractOp CompositeExtractOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeExtractOp CompositeExtractOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CompositeExtractOp::verifyInvariantsImpl() { auto tblgen_indices = getProperties().indices; (void)tblgen_indices; if (!tblgen_indices) return emitOpError("requires attribute 'indices'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(*this, tblgen_indices, "indices"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps11(*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_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CompositeExtractOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult CompositeExtractOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.indices; auto indicesAttrName = ::mlir::StringAttr::get(ctx, "indices"); auto attr = dict.get(indicesAttrName); usedKeys.insert(indicesAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for indices in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `indices` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void CompositeExtractOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CompositeExtractOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::CompositeExtractOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CompositeInsertOp definitions //===----------------------------------------------------------------------===// namespace detail { CompositeInsertOpGenericAdaptorBase::CompositeInsertOpGenericAdaptorBase(CompositeInsertOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::ArrayAttr CompositeInsertOpGenericAdaptorBase::getIndices() { auto attr = getIndicesAttr(); return attr; } } // namespace detail CompositeInsertOpAdaptor::CompositeInsertOpAdaptor(CompositeInsertOp op) : CompositeInsertOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CompositeInsertOpAdaptor::verify(::mlir::Location loc) { auto tblgen_indices = getProperties().indices; (void)tblgen_indices; if (!tblgen_indices) return emitError(loc, "'spirv.CompositeInsert' op requires attribute 'indices'"); if (tblgen_indices && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_indices))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_indices), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) return emitError(loc, "'spirv.CompositeInsert' op attribute 'indices' failed to satisfy constraint: 32-bit integer array attribute"); return ::mlir::success(); } ::llvm::LogicalResult CompositeInsertOp::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.indices; auto attr = dict.get("indices"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `indices` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute CompositeInsertOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.indices; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("indices", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code CompositeInsertOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.indices.getAsOpaquePointer())); } std::optional CompositeInsertOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "indices") return prop.indices; return std::nullopt; } void CompositeInsertOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "indices") { prop.indices = ::llvm::dyn_cast_or_null>(value); return; } } void CompositeInsertOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.indices) attrs.append("indices", prop.indices); } ::llvm::LogicalResult CompositeInsertOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getIndicesAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(attr, "indices", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult CompositeInsertOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.indices))) return ::mlir::failure(); return ::mlir::success(); } void CompositeInsertOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.indices); } ::mlir::ArrayAttr CompositeInsertOp::getIndices() { auto attr = getIndicesAttr(); return attr; } CompositeInsertOp CompositeInsertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value object, Value composite, ArrayRef indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(object), std::forward(composite), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeInsertOp CompositeInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, Value object, Value composite, ArrayRef indices) { return create(builder, builder.getLoc(), std::forward(object), std::forward(composite), std::forward(indices)); } void CompositeInsertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value object, ::mlir::Value composite, ::mlir::ArrayAttr indices) { odsState.addOperands(object); odsState.addOperands(composite); odsState.getOrAddProperties().indices = indices; odsState.addTypes(result); } CompositeInsertOp CompositeInsertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value object, ::mlir::Value composite, ::mlir::ArrayAttr indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(object), std::forward(composite), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeInsertOp CompositeInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value object, ::mlir::Value composite, ::mlir::ArrayAttr indices) { return create(builder, builder.getLoc(), std::forward(result), std::forward(object), std::forward(composite), std::forward(indices)); } void CompositeInsertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::mlir::Value composite, ::mlir::ArrayAttr indices) { odsState.addOperands(object); odsState.addOperands(composite); odsState.getOrAddProperties().indices = indices; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } CompositeInsertOp CompositeInsertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::mlir::Value composite, ::mlir::ArrayAttr indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(object), std::forward(composite), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeInsertOp CompositeInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::mlir::Value composite, ::mlir::ArrayAttr indices) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(object), std::forward(composite), std::forward(indices)); } void CompositeInsertOp::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(); ::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."); } } CompositeInsertOp CompositeInsertOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeInsertOp CompositeInsertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CompositeInsertOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CompositeInsertOp CompositeInsertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CompositeInsertOp CompositeInsertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CompositeInsertOp::verifyInvariantsImpl() { auto tblgen_indices = getProperties().indices; (void)tblgen_indices; if (!tblgen_indices) return emitOpError("requires attribute 'indices'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(*this, tblgen_indices, "indices"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps12(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps11(*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_SPIRVOps11(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CompositeInsertOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult CompositeInsertOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.indices; auto indicesAttrName = ::mlir::StringAttr::get(ctx, "indices"); auto attr = dict.get(indicesAttrName); usedKeys.insert(indicesAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for indices in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `indices` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void CompositeInsertOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CompositeInsertOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::CompositeInsertOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ConstantOp definitions //===----------------------------------------------------------------------===// namespace detail { ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::Attribute ConstantOpGenericAdaptorBase::getValue() { auto attr = getValueAttr(); return attr; } } // namespace detail ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : ConstantOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) { auto tblgen_value = getProperties().value; (void)tblgen_value; if (!tblgen_value) return emitError(loc, "'spirv.Constant' op requires attribute 'value'"); if (tblgen_value && !((true))) return emitError(loc, "'spirv.Constant' op attribute 'value' failed to satisfy constraint: any attribute"); return ::mlir::success(); } ::llvm::LogicalResult ConstantOp::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.value; auto attr = dict.get("value"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `value` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.value; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("value", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ConstantOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.value.getAsOpaquePointer())); } std::optional ConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "value") return prop.value; return std::nullopt; } void ConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "value") { prop.value = ::llvm::dyn_cast_or_null>(value); return; } } void ConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.value) attrs.append("value", prop.value); } ::llvm::LogicalResult ConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps5(attr, "value", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.value))) return ::mlir::failure(); return ::mlir::success(); } void ConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.value); } ::mlir::Attribute ConstantOp::getValue() { auto attr = getValueAttr(); return attr; } void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type constant, ::mlir::Attribute value) { odsState.getOrAddProperties().value = value; odsState.addTypes(constant); } ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type constant, ::mlir::Attribute value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(constant), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type constant, ::mlir::Attribute value) { return create(builder, builder.getLoc(), std::forward(constant), std::forward(value)); } void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) { odsState.getOrAddProperties().value = value; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(value)); } void ConstantOp::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() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } ConstantOp ConstantOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ConstantOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ConstantOp ConstantOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConstantOp ConstantOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ConstantOp::verifyInvariantsImpl() { auto tblgen_value = getProperties().value; (void)tblgen_value; if (!tblgen_value) return emitOpError("requires attribute 'value'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps5(*this, tblgen_value, "value"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ConstantOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult ConstantOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.value; auto valueAttrName = ::mlir::StringAttr::get(ctx, "value"); auto attr = dict.get(valueAttrName); usedKeys.insert(valueAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for value in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `value` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void ConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ConstantOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ConstantOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ControlBarrierOp definitions //===----------------------------------------------------------------------===// namespace detail { ControlBarrierOpGenericAdaptorBase::ControlBarrierOpGenericAdaptorBase(ControlBarrierOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope ControlBarrierOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::Scope ControlBarrierOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics ControlBarrierOpGenericAdaptorBase::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } } // namespace detail ControlBarrierOpAdaptor::ControlBarrierOpAdaptor(ControlBarrierOp op) : ControlBarrierOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ControlBarrierOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.ControlBarrier' op requires attribute 'execution_scope'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.ControlBarrier' op requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitError(loc, "'spirv.ControlBarrier' op requires attribute 'memory_semantics'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.ControlBarrier' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.ControlBarrier' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_memory_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_memory_semantics)))) return emitError(loc, "'spirv.ControlBarrier' op attribute 'memory_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult ControlBarrierOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_semantics; auto attr = dict.get("memory_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ControlBarrierOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.memory_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ControlBarrierOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.memory_semantics.getAsOpaquePointer())); } std::optional ControlBarrierOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "memory_scope") return prop.memory_scope; if (name == "memory_semantics") return prop.memory_semantics; return std::nullopt; } void ControlBarrierOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_semantics") { prop.memory_semantics = ::llvm::dyn_cast_or_null>(value); return; } } void ControlBarrierOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.memory_semantics) attrs.append("memory_semantics", prop.memory_semantics); } ::llvm::LogicalResult ControlBarrierOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemorySemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "memory_semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ControlBarrierOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_semantics))) return ::mlir::failure(); return ::mlir::success(); } void ControlBarrierOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.memory_semantics); } ::mlir::spirv::Scope ControlBarrierOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::Scope ControlBarrierOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics ControlBarrierOp::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } void ControlBarrierOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ControlBarrierOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ControlBarrierOp::setMemorySemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ControlBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; } ControlBarrierOp ControlBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ControlBarrierOp ControlBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void ControlBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ControlBarrierOp ControlBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ControlBarrierOp ControlBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void ControlBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); } ControlBarrierOp ControlBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ControlBarrierOp ControlBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void ControlBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ControlBarrierOp ControlBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ControlBarrierOp ControlBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void ControlBarrierOp::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(); ::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."); } } ControlBarrierOp ControlBarrierOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ControlBarrierOp ControlBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ControlBarrierOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ControlBarrierOp ControlBarrierOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ControlBarrierOp ControlBarrierOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ControlBarrierOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitOpError("requires attribute 'memory_semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_memory_semantics, "memory_semantics"))) return ::mlir::failure(); return ::mlir::success(); } ::llvm::LogicalResult ControlBarrierOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ControlBarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr memory_semanticsAttr; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(memory_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_semanticsAttr) result.getOrAddProperties().memory_semantics = memory_semanticsAttr; { 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 ControlBarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemorySemanticsAttr()); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("memory_semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ControlBarrierOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ControlBarrierOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ConvertFToSOp definitions //===----------------------------------------------------------------------===// namespace detail { ConvertFToSOpGenericAdaptorBase::ConvertFToSOpGenericAdaptorBase(ConvertFToSOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ConvertFToSOpAdaptor::ConvertFToSOpAdaptor(ConvertFToSOp op) : ConvertFToSOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ConvertFToSOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ConvertFToSOp::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 ConvertFToSOp::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 ConvertFToSOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ConvertFToSOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ConvertFToSOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ConvertFToSOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ConvertFToSOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ConvertFToSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } ConvertFToSOp ConvertFToSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertFToSOp ConvertFToSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void ConvertFToSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ConvertFToSOp ConvertFToSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertFToSOp ConvertFToSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void ConvertFToSOp::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); } ConvertFToSOp ConvertFToSOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertFToSOp ConvertFToSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ConvertFToSOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ConvertFToSOp ConvertFToSOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertFToSOp ConvertFToSOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ConvertFToSOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps13(*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_SPIRVOps14(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ConvertFToSOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ConvertFToSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ConvertFToSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ConvertFToSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ConvertFToSOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ConvertFToUOp definitions //===----------------------------------------------------------------------===// namespace detail { ConvertFToUOpGenericAdaptorBase::ConvertFToUOpGenericAdaptorBase(ConvertFToUOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ConvertFToUOpAdaptor::ConvertFToUOpAdaptor(ConvertFToUOp op) : ConvertFToUOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ConvertFToUOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ConvertFToUOp::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 ConvertFToUOp::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 ConvertFToUOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ConvertFToUOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ConvertFToUOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ConvertFToUOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ConvertFToUOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ConvertFToUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } ConvertFToUOp ConvertFToUOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertFToUOp ConvertFToUOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void ConvertFToUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ConvertFToUOp ConvertFToUOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertFToUOp ConvertFToUOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void ConvertFToUOp::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); } ConvertFToUOp ConvertFToUOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertFToUOp ConvertFToUOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ConvertFToUOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ConvertFToUOp ConvertFToUOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertFToUOp ConvertFToUOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ConvertFToUOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps13(*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_SPIRVOps14(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ConvertFToUOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ConvertFToUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ConvertFToUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ConvertFToUOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ConvertFToUOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ConvertPtrToUOp definitions //===----------------------------------------------------------------------===// namespace detail { ConvertPtrToUOpGenericAdaptorBase::ConvertPtrToUOpGenericAdaptorBase(ConvertPtrToUOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ConvertPtrToUOpAdaptor::ConvertPtrToUOpAdaptor(ConvertPtrToUOp op) : ConvertPtrToUOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ConvertPtrToUOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ConvertPtrToUOp::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 ConvertPtrToUOp::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 ConvertPtrToUOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ConvertPtrToUOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ConvertPtrToUOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ConvertPtrToUOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ConvertPtrToUOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ConvertPtrToUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer) { odsState.addOperands(pointer); odsState.addTypes(result); } ConvertPtrToUOp ConvertPtrToUOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertPtrToUOp ConvertPtrToUOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer)); } void ConvertPtrToUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { odsState.addOperands(pointer); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ConvertPtrToUOp ConvertPtrToUOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertPtrToUOp ConvertPtrToUOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer)); } void ConvertPtrToUOp::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); } ConvertPtrToUOp ConvertPtrToUOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertPtrToUOp ConvertPtrToUOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ConvertPtrToUOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ConvertPtrToUOp ConvertPtrToUOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertPtrToUOp ConvertPtrToUOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ConvertPtrToUOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps5(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ConvertPtrToUOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ConvertPtrToUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand pointerRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pointerOperands(&pointerRawOperand, 1); ::llvm::SMLoc pointerOperandsLoc; (void)pointerOperandsLoc; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); pointerOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(pointerRawOperand)) 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(); pointerRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(pointerOperands, pointerTypes, pointerOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ConvertPtrToUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPointer(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ConvertPtrToUOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ConvertSToFOp definitions //===----------------------------------------------------------------------===// namespace detail { ConvertSToFOpGenericAdaptorBase::ConvertSToFOpGenericAdaptorBase(ConvertSToFOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ConvertSToFOpAdaptor::ConvertSToFOpAdaptor(ConvertSToFOp op) : ConvertSToFOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ConvertSToFOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ConvertSToFOp::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 ConvertSToFOp::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 ConvertSToFOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ConvertSToFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ConvertSToFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ConvertSToFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ConvertSToFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ConvertSToFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } ConvertSToFOp ConvertSToFOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertSToFOp ConvertSToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void ConvertSToFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ConvertSToFOp ConvertSToFOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertSToFOp ConvertSToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void ConvertSToFOp::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); } ConvertSToFOp ConvertSToFOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertSToFOp ConvertSToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ConvertSToFOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ConvertSToFOp ConvertSToFOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertSToFOp ConvertSToFOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ConvertSToFOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps13(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ConvertSToFOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ConvertSToFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ConvertSToFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ConvertSToFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ConvertSToFOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ConvertUToFOp definitions //===----------------------------------------------------------------------===// namespace detail { ConvertUToFOpGenericAdaptorBase::ConvertUToFOpGenericAdaptorBase(ConvertUToFOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ConvertUToFOpAdaptor::ConvertUToFOpAdaptor(ConvertUToFOp op) : ConvertUToFOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ConvertUToFOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ConvertUToFOp::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 ConvertUToFOp::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 ConvertUToFOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ConvertUToFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ConvertUToFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ConvertUToFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ConvertUToFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ConvertUToFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } ConvertUToFOp ConvertUToFOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertUToFOp ConvertUToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void ConvertUToFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ConvertUToFOp ConvertUToFOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertUToFOp ConvertUToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void ConvertUToFOp::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); } ConvertUToFOp ConvertUToFOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertUToFOp ConvertUToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ConvertUToFOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ConvertUToFOp ConvertUToFOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertUToFOp ConvertUToFOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ConvertUToFOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps13(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ConvertUToFOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ConvertUToFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ConvertUToFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ConvertUToFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ConvertUToFOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ConvertUToPtrOp definitions //===----------------------------------------------------------------------===// namespace detail { ConvertUToPtrOpGenericAdaptorBase::ConvertUToPtrOpGenericAdaptorBase(ConvertUToPtrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ConvertUToPtrOpAdaptor::ConvertUToPtrOpAdaptor(ConvertUToPtrOp op) : ConvertUToPtrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ConvertUToPtrOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ConvertUToPtrOp::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 ConvertUToPtrOp::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 ConvertUToPtrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ConvertUToPtrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ConvertUToPtrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ConvertUToPtrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ConvertUToPtrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ConvertUToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } ConvertUToPtrOp ConvertUToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertUToPtrOp ConvertUToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void ConvertUToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ConvertUToPtrOp ConvertUToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertUToPtrOp ConvertUToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void ConvertUToPtrOp::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); } ConvertUToPtrOp ConvertUToPtrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertUToPtrOp ConvertUToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ConvertUToPtrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ConvertUToPtrOp ConvertUToPtrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ConvertUToPtrOp ConvertUToPtrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ConvertUToPtrOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ConvertUToPtrOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ConvertUToPtrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ConvertUToPtrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ConvertUToPtrOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::CopyMemoryOp definitions //===----------------------------------------------------------------------===// namespace detail { CopyMemoryOpGenericAdaptorBase::CopyMemoryOpGenericAdaptorBase(CopyMemoryOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::MemoryAccess> CopyMemoryOpGenericAdaptorBase::getMemoryAccess() { auto attr = getMemoryAccessAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional CopyMemoryOpGenericAdaptorBase::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } ::std::optional<::mlir::spirv::MemoryAccess> CopyMemoryOpGenericAdaptorBase::getSourceMemoryAccess() { auto attr = getSourceMemoryAccessAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional CopyMemoryOpGenericAdaptorBase::getSourceAlignment() { auto attr = getSourceAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } } // namespace detail CopyMemoryOpAdaptor::CopyMemoryOpAdaptor(CopyMemoryOp op) : CopyMemoryOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult CopyMemoryOpAdaptor::verify(::mlir::Location loc) { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_memory_access = getProperties().memory_access; (void)tblgen_memory_access; auto tblgen_source_alignment = getProperties().source_alignment; (void)tblgen_source_alignment; auto tblgen_source_memory_access = getProperties().source_memory_access; (void)tblgen_source_memory_access; if (tblgen_memory_access && !((::llvm::isa<::mlir::spirv::MemoryAccessAttr>(tblgen_memory_access)))) return emitError(loc, "'spirv.CopyMemory' op attribute 'memory_access' failed to satisfy constraint: valid SPIR-V MemoryAccess"); if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32)))) && (((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isStrictlyPositive())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isPowerOf2()))))) return emitError(loc, "'spirv.CopyMemory' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0"); if (tblgen_source_memory_access && !((::llvm::isa<::mlir::spirv::MemoryAccessAttr>(tblgen_source_memory_access)))) return emitError(loc, "'spirv.CopyMemory' op attribute 'source_memory_access' failed to satisfy constraint: valid SPIR-V MemoryAccess"); if (tblgen_source_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_source_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_source_alignment).getType().isSignlessInteger(32)))) && (((::llvm::cast<::mlir::IntegerAttr>(tblgen_source_alignment).getValue().isStrictlyPositive())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_source_alignment).getValue().isPowerOf2()))))) return emitError(loc, "'spirv.CopyMemory' op attribute 'source_alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0"); return ::mlir::success(); } ::llvm::LogicalResult CopyMemoryOp::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.alignment; auto attr = dict.get("alignment"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `alignment` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_access; auto attr = dict.get("memory_access"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_access` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.source_alignment; auto attr = dict.get("source_alignment"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `source_alignment` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.source_memory_access; auto attr = dict.get("source_memory_access"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `source_memory_access` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute CopyMemoryOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.alignment; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("alignment", propStorage)); } { const auto &propStorage = prop.memory_access; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_access", propStorage)); } { const auto &propStorage = prop.source_alignment; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("source_alignment", propStorage)); } { const auto &propStorage = prop.source_memory_access; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("source_memory_access", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code CopyMemoryOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.alignment.getAsOpaquePointer()), llvm::hash_value(prop.memory_access.getAsOpaquePointer()), llvm::hash_value(prop.source_alignment.getAsOpaquePointer()), llvm::hash_value(prop.source_memory_access.getAsOpaquePointer())); } std::optional CopyMemoryOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "alignment") return prop.alignment; if (name == "memory_access") return prop.memory_access; if (name == "source_alignment") return prop.source_alignment; if (name == "source_memory_access") return prop.source_memory_access; return std::nullopt; } void CopyMemoryOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "alignment") { prop.alignment = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_access") { prop.memory_access = ::llvm::dyn_cast_or_null>(value); return; } if (name == "source_alignment") { prop.source_alignment = ::llvm::dyn_cast_or_null>(value); return; } if (name == "source_memory_access") { prop.source_memory_access = ::llvm::dyn_cast_or_null>(value); return; } } void CopyMemoryOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.alignment) attrs.append("alignment", prop.alignment); if (prop.memory_access) attrs.append("memory_access", prop.memory_access); if (prop.source_alignment) attrs.append("source_alignment", prop.source_alignment); if (prop.source_memory_access) attrs.append("source_memory_access", prop.source_memory_access); } ::llvm::LogicalResult CopyMemoryOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(attr, "alignment", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryAccessAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(attr, "memory_access", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSourceAlignmentAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(attr, "source_alignment", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSourceMemoryAccessAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(attr, "source_memory_access", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult CopyMemoryOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.memory_access))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.source_alignment))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.source_memory_access))) return ::mlir::failure(); return ::mlir::success(); } void CopyMemoryOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.alignment); writer.writeOptionalAttribute(prop.memory_access); writer.writeOptionalAttribute(prop.source_alignment); writer.writeOptionalAttribute(prop.source_memory_access); } ::std::optional<::mlir::spirv::MemoryAccess> CopyMemoryOp::getMemoryAccess() { auto attr = getMemoryAccessAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional CopyMemoryOp::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } ::std::optional<::mlir::spirv::MemoryAccess> CopyMemoryOp::getSourceMemoryAccess() { auto attr = getSourceMemoryAccessAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional CopyMemoryOp::getSourceAlignment() { auto attr = getSourceAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } void CopyMemoryOp::setMemoryAccess(::std::optional<::mlir::spirv::MemoryAccess> attrValue) { auto &odsProp = getProperties().memory_access; if (attrValue) odsProp = ::mlir::spirv::MemoryAccessAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void CopyMemoryOp::setAlignment(::std::optional attrValue) { auto &odsProp = getProperties().alignment; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } void CopyMemoryOp::setSourceMemoryAccess(::std::optional<::mlir::spirv::MemoryAccess> attrValue) { auto &odsProp = getProperties().source_memory_access; if (attrValue) odsProp = ::mlir::spirv::MemoryAccessAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void CopyMemoryOp::setSourceAlignment(::std::optional attrValue) { auto &odsProp = getProperties().source_alignment; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } void CopyMemoryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value target, ::mlir::Value source, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::spirv::MemoryAccessAttr source_memory_access, /*optional*/::mlir::IntegerAttr source_alignment) { odsState.addOperands(target); odsState.addOperands(source); if (memory_access) { odsState.getOrAddProperties().memory_access = memory_access; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } if (source_memory_access) { odsState.getOrAddProperties().source_memory_access = source_memory_access; } if (source_alignment) { odsState.getOrAddProperties().source_alignment = source_alignment; } } CopyMemoryOp CopyMemoryOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value target, ::mlir::Value source, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::spirv::MemoryAccessAttr source_memory_access, /*optional*/::mlir::IntegerAttr source_alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(target), std::forward(source), std::forward(memory_access), std::forward(alignment), std::forward(source_memory_access), std::forward(source_alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CopyMemoryOp CopyMemoryOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value target, ::mlir::Value source, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::spirv::MemoryAccessAttr source_memory_access, /*optional*/::mlir::IntegerAttr source_alignment) { return create(builder, builder.getLoc(), std::forward(target), std::forward(source), std::forward(memory_access), std::forward(alignment), std::forward(source_memory_access), std::forward(source_alignment)); } void CopyMemoryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::mlir::Value source, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::spirv::MemoryAccessAttr source_memory_access, /*optional*/::mlir::IntegerAttr source_alignment) { odsState.addOperands(target); odsState.addOperands(source); if (memory_access) { odsState.getOrAddProperties().memory_access = memory_access; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } if (source_memory_access) { odsState.getOrAddProperties().source_memory_access = source_memory_access; } if (source_alignment) { odsState.getOrAddProperties().source_alignment = source_alignment; } assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } CopyMemoryOp CopyMemoryOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::mlir::Value source, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::spirv::MemoryAccessAttr source_memory_access, /*optional*/::mlir::IntegerAttr source_alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(target), std::forward(source), std::forward(memory_access), std::forward(alignment), std::forward(source_memory_access), std::forward(source_alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CopyMemoryOp CopyMemoryOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::mlir::Value source, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::spirv::MemoryAccessAttr source_memory_access, /*optional*/::mlir::IntegerAttr source_alignment) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(target), std::forward(source), std::forward(memory_access), std::forward(alignment), std::forward(source_memory_access), std::forward(source_alignment)); } void CopyMemoryOp::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(); ::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."); } } CopyMemoryOp CopyMemoryOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CopyMemoryOp CopyMemoryOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void CopyMemoryOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } CopyMemoryOp CopyMemoryOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } CopyMemoryOp CopyMemoryOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult CopyMemoryOp::verifyInvariantsImpl() { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_memory_access = getProperties().memory_access; (void)tblgen_memory_access; auto tblgen_source_alignment = getProperties().source_alignment; (void)tblgen_source_alignment; auto tblgen_source_memory_access = getProperties().source_memory_access; (void)tblgen_source_memory_access; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(*this, tblgen_memory_access, "memory_access"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(*this, tblgen_alignment, "alignment"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(*this, tblgen_source_memory_access, "source_memory_access"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(*this, tblgen_source_alignment, "source_alignment"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult CopyMemoryOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult CopyMemoryOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.memory_access; auto memory_accessAttrName = ::mlir::StringAttr::get(ctx, "memory_access"); auto attr = dict.get(memory_accessAttrName); usedKeys.insert(memory_accessAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for memory_access in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_access` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.alignment; auto alignmentAttrName = ::mlir::StringAttr::get(ctx, "alignment"); auto attr = dict.get(alignmentAttrName); usedKeys.insert(alignmentAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for alignment in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `alignment` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.source_memory_access; auto source_memory_accessAttrName = ::mlir::StringAttr::get(ctx, "source_memory_access"); auto attr = dict.get(source_memory_accessAttrName); usedKeys.insert(source_memory_accessAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for source_memory_access in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `source_memory_access` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.source_alignment; auto source_alignmentAttrName = ::mlir::StringAttr::get(ctx, "source_alignment"); auto attr = dict.get(source_alignmentAttrName); usedKeys.insert(source_alignmentAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for source_alignment in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `source_alignment` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::CopyMemoryOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::CopyMemoryOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::DotOp definitions //===----------------------------------------------------------------------===// namespace detail { DotOpGenericAdaptorBase::DotOpGenericAdaptorBase(DotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail DotOpAdaptor::DotOpAdaptor(DotOp op) : DotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult DotOpAdaptor::verify(::mlir::Location loc) { 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(); } return ::mlir::success(); } ::mlir::Attribute DotOp::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 DotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional DotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void DotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void DotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult DotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addTypes(result); } DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2)); } void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2) { odsState.addOperands(vector1); odsState.addOperands(vector2); 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 vector1, ::mlir::Value vector2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2)); auto __res__ = ::llvm::dyn_cast(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 vector1, ::mlir::Value vector2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2)); } void DotOp::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); } 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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(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(resultTypes), std::forward(operands), std::forward(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() == 2u && "mismatched number of parameters"); odsState.addOperands(operands); odsState.useProperties(const_cast(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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult DotOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps15(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps15(*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_SPIRVOps16(*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->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that all of {vector1, vector2} have same type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {vector1, result} have same element type"); return ::mlir::success(); } ::llvm::LogicalResult DotOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult DotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); vector1RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(vector1Types), ::llvm::ArrayRef<::mlir::Type>(vector1Types[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void DotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 DotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::DotOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::EXTAtomicFAddOp definitions //===----------------------------------------------------------------------===// namespace detail { EXTAtomicFAddOpGenericAdaptorBase::EXTAtomicFAddOpGenericAdaptorBase(EXTAtomicFAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope EXTAtomicFAddOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics EXTAtomicFAddOpGenericAdaptorBase::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } } // namespace detail EXTAtomicFAddOpAdaptor::EXTAtomicFAddOpAdaptor(EXTAtomicFAddOp op) : EXTAtomicFAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult EXTAtomicFAddOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.EXT.AtomicFAdd' op requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitError(loc, "'spirv.EXT.AtomicFAdd' op requires attribute 'semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.EXT.AtomicFAdd' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_semantics)))) return emitError(loc, "'spirv.EXT.AtomicFAdd' op attribute 'semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult EXTAtomicFAddOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.semantics; auto attr = dict.get("semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute EXTAtomicFAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code EXTAtomicFAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.semantics.getAsOpaquePointer())); } std::optional EXTAtomicFAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "semantics") return prop.semantics; return std::nullopt; } void EXTAtomicFAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "semantics") { prop.semantics = ::llvm::dyn_cast_or_null>(value); return; } } void EXTAtomicFAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.semantics) attrs.append("semantics", prop.semantics); } ::llvm::LogicalResult EXTAtomicFAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult EXTAtomicFAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.semantics))) return ::mlir::failure(); return ::mlir::success(); } void EXTAtomicFAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.semantics); } ::mlir::spirv::Scope EXTAtomicFAddOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics EXTAtomicFAddOp::getSemantics() { auto attr = getSemanticsAttr(); return attr.getValue(); } void EXTAtomicFAddOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void EXTAtomicFAddOp::setSemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void EXTAtomicFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; odsState.addTypes(result); } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void EXTAtomicFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(EXTAtomicFAddOp::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); } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void EXTAtomicFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().semantics = semantics; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void EXTAtomicFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); odsState.addTypes(result); } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void EXTAtomicFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(EXTAtomicFAddOp::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); } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void EXTAtomicFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { odsState.addOperands(pointer); odsState.addOperands(value); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), semantics); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics semantics, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(memory_scope), std::forward(semantics), std::forward(value)); } void EXTAtomicFAddOp::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(); ::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."); } } EXTAtomicFAddOp EXTAtomicFAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void EXTAtomicFAddOp::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(); ::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(EXTAtomicFAddOp::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)."); } } EXTAtomicFAddOp EXTAtomicFAddOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void EXTAtomicFAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EXTAtomicFAddOp EXTAtomicFAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void EXTAtomicFAddOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(EXTAtomicFAddOp::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)."); } } EXTAtomicFAddOp EXTAtomicFAddOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTAtomicFAddOp EXTAtomicFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult EXTAtomicFAddOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_semantics = getProperties().semantics; (void)tblgen_semantics; if (!tblgen_semantics) return emitOpError("requires attribute 'semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_semantics, "semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps17(*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_SPIRVOps17(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that `result` type matches pointee type of `pointer`"); if (!((std::equal_to<>()(llvm::cast((*this->getODSOperands(0).begin()).getType()).getPointeeType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that `value` type matches pointee type of `pointer`"); return ::mlir::success(); } ::llvm::LogicalResult EXTAtomicFAddOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult EXTAtomicFAddOp::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 = llvm::cast(operands[0].getType()).getPointeeType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult EXTAtomicFAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr semanticsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (semanticsAttr) result.getOrAddProperties().semantics = semanticsAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); pointerRawType = type; } for (::mlir::Type type : pointerTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::PointerType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'pointer' must be any SPIR-V pointer type, but got " << type; } } result.addTypes(llvm::cast(pointerTypes[0]).getPointeeType()); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(pointerTypes), ::llvm::ArrayRef<::mlir::Type>(llvm::cast(pointerTypes[0]).getPointeeType())), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void EXTAtomicFAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getSemanticsAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::EXTAtomicFAddOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::EXTAtomicFAddOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::EXTConstantCompositeReplicateOp definitions //===----------------------------------------------------------------------===// namespace detail { EXTConstantCompositeReplicateOpGenericAdaptorBase::EXTConstantCompositeReplicateOpGenericAdaptorBase(EXTConstantCompositeReplicateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::Attribute EXTConstantCompositeReplicateOpGenericAdaptorBase::getValue() { auto attr = getValueAttr(); return attr; } } // namespace detail EXTConstantCompositeReplicateOpAdaptor::EXTConstantCompositeReplicateOpAdaptor(EXTConstantCompositeReplicateOp op) : EXTConstantCompositeReplicateOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult EXTConstantCompositeReplicateOpAdaptor::verify(::mlir::Location loc) { auto tblgen_value = getProperties().value; (void)tblgen_value; if (!tblgen_value) return emitError(loc, "'spirv.EXT.ConstantCompositeReplicate' op requires attribute 'value'"); if (tblgen_value && !((true))) return emitError(loc, "'spirv.EXT.ConstantCompositeReplicate' op attribute 'value' failed to satisfy constraint: any attribute"); return ::mlir::success(); } ::llvm::LogicalResult EXTConstantCompositeReplicateOp::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.value; auto attr = dict.get("value"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `value` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute EXTConstantCompositeReplicateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.value; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("value", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code EXTConstantCompositeReplicateOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.value.getAsOpaquePointer())); } std::optional EXTConstantCompositeReplicateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "value") return prop.value; return std::nullopt; } void EXTConstantCompositeReplicateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "value") { prop.value = ::llvm::dyn_cast_or_null>(value); return; } } void EXTConstantCompositeReplicateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.value) attrs.append("value", prop.value); } ::llvm::LogicalResult EXTConstantCompositeReplicateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps5(attr, "value", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult EXTConstantCompositeReplicateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.value))) return ::mlir::failure(); return ::mlir::success(); } void EXTConstantCompositeReplicateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.value); } ::mlir::Attribute EXTConstantCompositeReplicateOp::getValue() { auto attr = getValueAttr(); return attr; } void EXTConstantCompositeReplicateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type replicated_constant, ::mlir::Attribute value) { odsState.getOrAddProperties().value = value; odsState.addTypes(replicated_constant); } EXTConstantCompositeReplicateOp EXTConstantCompositeReplicateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type replicated_constant, ::mlir::Attribute value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(replicated_constant), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTConstantCompositeReplicateOp EXTConstantCompositeReplicateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type replicated_constant, ::mlir::Attribute value) { return create(builder, builder.getLoc(), std::forward(replicated_constant), std::forward(value)); } void EXTConstantCompositeReplicateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) { odsState.getOrAddProperties().value = value; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } EXTConstantCompositeReplicateOp EXTConstantCompositeReplicateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTConstantCompositeReplicateOp EXTConstantCompositeReplicateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(value)); } void EXTConstantCompositeReplicateOp::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() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } EXTConstantCompositeReplicateOp EXTConstantCompositeReplicateOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTConstantCompositeReplicateOp EXTConstantCompositeReplicateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void EXTConstantCompositeReplicateOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EXTConstantCompositeReplicateOp EXTConstantCompositeReplicateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTConstantCompositeReplicateOp EXTConstantCompositeReplicateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult EXTConstantCompositeReplicateOp::verifyInvariantsImpl() { auto tblgen_value = getProperties().value; (void)tblgen_value; if (!tblgen_value) return emitOpError("requires attribute 'value'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps5(*this, tblgen_value, "value"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps11(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult EXTConstantCompositeReplicateOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult EXTConstantCompositeReplicateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::Attribute valueAttr; ::mlir::Type replicated_constantRawType{}; ::llvm::ArrayRef<::mlir::Type> replicated_constantTypes(&replicated_constantRawType, 1); if (parser.parseLSquare()) return ::mlir::failure(); if (parser.parseAttribute(valueAttr, ::mlir::Type{})) return ::mlir::failure(); if (valueAttr) result.getOrAddProperties().value = valueAttr; if (parser.parseRSquare()) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); replicated_constantRawType = type; } { 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(); } result.addTypes(replicated_constantTypes); return ::mlir::success(); } void EXTConstantCompositeReplicateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << "["; _odsPrinter.printAttribute(getValueAttr()); _odsPrinter << "]"; _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getReplicatedConstant().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("value"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void EXTConstantCompositeReplicateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::EXTConstantCompositeReplicateOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::EXTConstantCompositeReplicateOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::EXTEmitMeshTasksOp definitions //===----------------------------------------------------------------------===// namespace detail { EXTEmitMeshTasksOpGenericAdaptorBase::EXTEmitMeshTasksOpGenericAdaptorBase(EXTEmitMeshTasksOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair EXTEmitMeshTasksOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {false, 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 - 3) / 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 EXTEmitMeshTasksOpAdaptor::EXTEmitMeshTasksOpAdaptor(EXTEmitMeshTasksOp op) : EXTEmitMeshTasksOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult EXTEmitMeshTasksOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair EXTEmitMeshTasksOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {false, 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() - 3) / 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 EXTEmitMeshTasksOp::getPayloadMutable() { auto range = getODSOperandIndexAndLength(3); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult EXTEmitMeshTasksOp::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 EXTEmitMeshTasksOp::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 EXTEmitMeshTasksOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional EXTEmitMeshTasksOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void EXTEmitMeshTasksOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void EXTEmitMeshTasksOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult EXTEmitMeshTasksOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void EXTEmitMeshTasksOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value group_count_x, ::mlir::Value group_count_y, ::mlir::Value group_count_z, /*optional*/::mlir::Value payload) { odsState.addOperands(group_count_x); odsState.addOperands(group_count_y); odsState.addOperands(group_count_z); if (payload) odsState.addOperands(payload); } EXTEmitMeshTasksOp EXTEmitMeshTasksOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value group_count_x, ::mlir::Value group_count_y, ::mlir::Value group_count_z, /*optional*/::mlir::Value payload) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(group_count_x), std::forward(group_count_y), std::forward(group_count_z), std::forward(payload)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTEmitMeshTasksOp EXTEmitMeshTasksOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value group_count_x, ::mlir::Value group_count_y, ::mlir::Value group_count_z, /*optional*/::mlir::Value payload) { return create(builder, builder.getLoc(), std::forward(group_count_x), std::forward(group_count_y), std::forward(group_count_z), std::forward(payload)); } void EXTEmitMeshTasksOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value group_count_x, ::mlir::Value group_count_y, ::mlir::Value group_count_z, /*optional*/::mlir::Value payload) { odsState.addOperands(group_count_x); odsState.addOperands(group_count_y); odsState.addOperands(group_count_z); if (payload) odsState.addOperands(payload); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } EXTEmitMeshTasksOp EXTEmitMeshTasksOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value group_count_x, ::mlir::Value group_count_y, ::mlir::Value group_count_z, /*optional*/::mlir::Value payload) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(group_count_x), std::forward(group_count_y), std::forward(group_count_z), std::forward(payload)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTEmitMeshTasksOp EXTEmitMeshTasksOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value group_count_x, ::mlir::Value group_count_y, ::mlir::Value group_count_z, /*optional*/::mlir::Value payload) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(group_count_x), std::forward(group_count_y), std::forward(group_count_z), std::forward(payload)); } void EXTEmitMeshTasksOp::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() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EXTEmitMeshTasksOp EXTEmitMeshTasksOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTEmitMeshTasksOp EXTEmitMeshTasksOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void EXTEmitMeshTasksOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EXTEmitMeshTasksOp EXTEmitMeshTasksOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTEmitMeshTasksOp EXTEmitMeshTasksOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult EXTEmitMeshTasksOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps18(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps18(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps18(*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_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult EXTEmitMeshTasksOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult EXTEmitMeshTasksOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void EXTEmitMeshTasksOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::EXTEmitMeshTasksOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::EXTSetMeshOutputsOp definitions //===----------------------------------------------------------------------===// namespace detail { EXTSetMeshOutputsOpGenericAdaptorBase::EXTSetMeshOutputsOpGenericAdaptorBase(EXTSetMeshOutputsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail EXTSetMeshOutputsOpAdaptor::EXTSetMeshOutputsOpAdaptor(EXTSetMeshOutputsOp op) : EXTSetMeshOutputsOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult EXTSetMeshOutputsOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult EXTSetMeshOutputsOp::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 EXTSetMeshOutputsOp::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 EXTSetMeshOutputsOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional EXTSetMeshOutputsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void EXTSetMeshOutputsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void EXTSetMeshOutputsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult EXTSetMeshOutputsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void EXTSetMeshOutputsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vertex_count, ::mlir::Value primitive_count) { odsState.addOperands(vertex_count); odsState.addOperands(primitive_count); } EXTSetMeshOutputsOp EXTSetMeshOutputsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vertex_count, ::mlir::Value primitive_count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(vertex_count), std::forward(primitive_count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSetMeshOutputsOp EXTSetMeshOutputsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vertex_count, ::mlir::Value primitive_count) { return create(builder, builder.getLoc(), std::forward(vertex_count), std::forward(primitive_count)); } void EXTSetMeshOutputsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vertex_count, ::mlir::Value primitive_count) { odsState.addOperands(vertex_count); odsState.addOperands(primitive_count); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } EXTSetMeshOutputsOp EXTSetMeshOutputsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vertex_count, ::mlir::Value primitive_count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vertex_count), std::forward(primitive_count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSetMeshOutputsOp EXTSetMeshOutputsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vertex_count, ::mlir::Value primitive_count) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vertex_count), std::forward(primitive_count)); } void EXTSetMeshOutputsOp::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); } EXTSetMeshOutputsOp EXTSetMeshOutputsOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSetMeshOutputsOp EXTSetMeshOutputsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void EXTSetMeshOutputsOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EXTSetMeshOutputsOp EXTSetMeshOutputsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSetMeshOutputsOp EXTSetMeshOutputsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult EXTSetMeshOutputsOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps18(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps18(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult EXTSetMeshOutputsOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult EXTSetMeshOutputsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void EXTSetMeshOutputsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::EXTSetMeshOutputsOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::EXTSpecConstantCompositeReplicateOp definitions //===----------------------------------------------------------------------===// namespace detail { EXTSpecConstantCompositeReplicateOpGenericAdaptorBase::EXTSpecConstantCompositeReplicateOpGenericAdaptorBase(EXTSpecConstantCompositeReplicateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::Type EXTSpecConstantCompositeReplicateOpGenericAdaptorBase::getType() { auto attr = getTypeAttr(); return ::llvm::cast<::mlir::Type>(attr.getValue()); } ::llvm::StringRef EXTSpecConstantCompositeReplicateOpGenericAdaptorBase::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::mlir::SymbolRefAttr EXTSpecConstantCompositeReplicateOpGenericAdaptorBase::getConstituent() { auto attr = getConstituentAttr(); return attr; } } // namespace detail EXTSpecConstantCompositeReplicateOpAdaptor::EXTSpecConstantCompositeReplicateOpAdaptor(EXTSpecConstantCompositeReplicateOp op) : EXTSpecConstantCompositeReplicateOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult EXTSpecConstantCompositeReplicateOpAdaptor::verify(::mlir::Location loc) { auto tblgen_constituent = getProperties().constituent; (void)tblgen_constituent; if (!tblgen_constituent) return emitError(loc, "'spirv.EXT.SpecConstantCompositeReplicate' op requires attribute 'constituent'"); auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitError(loc, "'spirv.EXT.SpecConstantCompositeReplicate' op requires attribute 'sym_name'"); auto tblgen_type = getProperties().type; (void)tblgen_type; if (!tblgen_type) return emitError(loc, "'spirv.EXT.SpecConstantCompositeReplicate' op requires attribute 'type'"); if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) return emitError(loc, "'spirv.EXT.SpecConstantCompositeReplicate' op attribute 'type' failed to satisfy constraint: any type attribute"); if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) return emitError(loc, "'spirv.EXT.SpecConstantCompositeReplicate' op attribute 'sym_name' failed to satisfy constraint: string attribute"); if (tblgen_constituent && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_constituent)))) return emitError(loc, "'spirv.EXT.SpecConstantCompositeReplicate' op attribute 'constituent' failed to satisfy constraint: symbol reference attribute"); return ::mlir::success(); } ::llvm::LogicalResult EXTSpecConstantCompositeReplicateOp::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.constituent; auto attr = dict.get("constituent"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `constituent` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto attr = dict.get("sym_name"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.type; auto attr = dict.get("type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `type` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute EXTSpecConstantCompositeReplicateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.constituent; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("constituent", propStorage)); } { const auto &propStorage = prop.sym_name; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("sym_name", propStorage)); } { const auto &propStorage = prop.type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("type", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code EXTSpecConstantCompositeReplicateOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.constituent.getAsOpaquePointer()), llvm::hash_value(prop.sym_name.getAsOpaquePointer()), llvm::hash_value(prop.type.getAsOpaquePointer())); } std::optional EXTSpecConstantCompositeReplicateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "constituent") return prop.constituent; if (name == "sym_name") return prop.sym_name; if (name == "type") return prop.type; return std::nullopt; } void EXTSpecConstantCompositeReplicateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "constituent") { prop.constituent = ::llvm::dyn_cast_or_null>(value); return; } if (name == "sym_name") { prop.sym_name = ::llvm::dyn_cast_or_null>(value); return; } if (name == "type") { prop.type = ::llvm::dyn_cast_or_null>(value); return; } } void EXTSpecConstantCompositeReplicateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.constituent) attrs.append("constituent", prop.constituent); if (prop.sym_name) attrs.append("sym_name", prop.sym_name); if (prop.type) attrs.append("type", prop.type); } ::llvm::LogicalResult EXTSpecConstantCompositeReplicateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getConstituentAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps10(attr, "constituent", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(attr, "sym_name", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps8(attr, "type", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult EXTSpecConstantCompositeReplicateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.constituent))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.sym_name))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.type))) return ::mlir::failure(); return ::mlir::success(); } void EXTSpecConstantCompositeReplicateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.constituent); writer.writeAttribute(prop.sym_name); writer.writeAttribute(prop.type); } ::mlir::Type EXTSpecConstantCompositeReplicateOp::getType() { auto attr = getTypeAttr(); return ::llvm::cast<::mlir::Type>(attr.getValue()); } ::llvm::StringRef EXTSpecConstantCompositeReplicateOp::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::mlir::SymbolRefAttr EXTSpecConstantCompositeReplicateOp::getConstituent() { auto attr = getConstituentAttr(); return attr; } void EXTSpecConstantCompositeReplicateOp::setType(::mlir::Type attrValue) { getProperties().type = ::mlir::TypeAttr::get(attrValue); } void EXTSpecConstantCompositeReplicateOp::setSymName(::llvm::StringRef attrValue) { getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue); } void EXTSpecConstantCompositeReplicateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr constituent) { odsState.getOrAddProperties().type = type; odsState.getOrAddProperties().sym_name = sym_name; odsState.getOrAddProperties().constituent = constituent; } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr constituent) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(sym_name), std::forward(constituent)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr constituent) { return create(builder, builder.getLoc(), std::forward(type), std::forward(sym_name), std::forward(constituent)); } void EXTSpecConstantCompositeReplicateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr constituent) { odsState.getOrAddProperties().type = type; odsState.getOrAddProperties().sym_name = sym_name; odsState.getOrAddProperties().constituent = constituent; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr constituent) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(constituent)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr constituent) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(constituent)); } void EXTSpecConstantCompositeReplicateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr constituent) { odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); odsState.getOrAddProperties().constituent = constituent; } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr constituent) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(sym_name), std::forward(constituent)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr constituent) { return create(builder, builder.getLoc(), std::forward(type), std::forward(sym_name), std::forward(constituent)); } void EXTSpecConstantCompositeReplicateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr constituent) { odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); odsState.getOrAddProperties().constituent = constituent; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr constituent) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(constituent)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr constituent) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(constituent)); } void EXTSpecConstantCompositeReplicateOp::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(); ::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."); } } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void EXTSpecConstantCompositeReplicateOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EXTSpecConstantCompositeReplicateOp EXTSpecConstantCompositeReplicateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult EXTSpecConstantCompositeReplicateOp::verifyInvariantsImpl() { auto tblgen_constituent = getProperties().constituent; (void)tblgen_constituent; if (!tblgen_constituent) return emitOpError("requires attribute 'constituent'"); auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); auto tblgen_type = getProperties().type; (void)tblgen_type; if (!tblgen_type) return emitOpError("requires attribute 'type'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps8(*this, tblgen_type, "type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(*this, tblgen_sym_name, "sym_name"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps10(*this, tblgen_constituent, "constituent"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult EXTSpecConstantCompositeReplicateOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult EXTSpecConstantCompositeReplicateOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.type; auto typeAttrName = ::mlir::StringAttr::get(ctx, "type"); auto attr = dict.get(typeAttrName); usedKeys.insert(typeAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for type in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name"); auto attr = dict.get(sym_nameAttrName); usedKeys.insert(sym_nameAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for sym_name in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.constituent; auto constituentAttrName = ::mlir::StringAttr::get(ctx, "constituent"); auto attr = dict.get(constituentAttrName); usedKeys.insert(constituentAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for constituent in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `constituent` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::EXTSpecConstantCompositeReplicateOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::EXTSpecConstantCompositeReplicateOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::EmitVertexOp definitions //===----------------------------------------------------------------------===// namespace detail { EmitVertexOpGenericAdaptorBase::EmitVertexOpGenericAdaptorBase(EmitVertexOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail EmitVertexOpAdaptor::EmitVertexOpAdaptor(EmitVertexOp op) : EmitVertexOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult EmitVertexOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult EmitVertexOp::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 EmitVertexOp::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 EmitVertexOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional EmitVertexOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void EmitVertexOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void EmitVertexOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult EmitVertexOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void EmitVertexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { } EmitVertexOp EmitVertexOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EmitVertexOp EmitVertexOp::create(::mlir::ImplicitLocOpBuilder &builder) { return create(builder, builder.getLoc()); } void EmitVertexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } EmitVertexOp EmitVertexOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EmitVertexOp EmitVertexOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) { return create(builder, builder.getLoc(), std::forward(resultTypes)); } void EmitVertexOp::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); } EmitVertexOp EmitVertexOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EmitVertexOp EmitVertexOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void EmitVertexOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EmitVertexOp EmitVertexOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EmitVertexOp EmitVertexOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult EmitVertexOp::verifyInvariantsImpl() { return ::mlir::success(); } ::llvm::LogicalResult EmitVertexOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult EmitVertexOp::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 EmitVertexOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::EmitVertexOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::EndPrimitiveOp definitions //===----------------------------------------------------------------------===// namespace detail { EndPrimitiveOpGenericAdaptorBase::EndPrimitiveOpGenericAdaptorBase(EndPrimitiveOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail EndPrimitiveOpAdaptor::EndPrimitiveOpAdaptor(EndPrimitiveOp op) : EndPrimitiveOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult EndPrimitiveOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult EndPrimitiveOp::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 EndPrimitiveOp::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 EndPrimitiveOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional EndPrimitiveOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void EndPrimitiveOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void EndPrimitiveOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult EndPrimitiveOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void EndPrimitiveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { } EndPrimitiveOp EndPrimitiveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EndPrimitiveOp EndPrimitiveOp::create(::mlir::ImplicitLocOpBuilder &builder) { return create(builder, builder.getLoc()); } void EndPrimitiveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } EndPrimitiveOp EndPrimitiveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EndPrimitiveOp EndPrimitiveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) { return create(builder, builder.getLoc(), std::forward(resultTypes)); } void EndPrimitiveOp::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); } EndPrimitiveOp EndPrimitiveOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EndPrimitiveOp EndPrimitiveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void EndPrimitiveOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EndPrimitiveOp EndPrimitiveOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EndPrimitiveOp EndPrimitiveOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult EndPrimitiveOp::verifyInvariantsImpl() { return ::mlir::success(); } ::llvm::LogicalResult EndPrimitiveOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult EndPrimitiveOp::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 EndPrimitiveOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::EndPrimitiveOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::EntryPointOp definitions //===----------------------------------------------------------------------===// namespace detail { EntryPointOpGenericAdaptorBase::EntryPointOpGenericAdaptorBase(EntryPointOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::ExecutionModel EntryPointOpGenericAdaptorBase::getExecutionModel() { auto attr = getExecutionModelAttr(); return attr.getValue(); } ::llvm::StringRef EntryPointOpGenericAdaptorBase::getFn() { auto attr = getFnAttr(); return attr.getValue(); } ::mlir::ArrayAttr EntryPointOpGenericAdaptorBase::getInterface() { auto attr = getInterfaceAttr(); return attr; } } // namespace detail EntryPointOpAdaptor::EntryPointOpAdaptor(EntryPointOp op) : EntryPointOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult EntryPointOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_model = getProperties().execution_model; (void)tblgen_execution_model; if (!tblgen_execution_model) return emitError(loc, "'spirv.EntryPoint' op requires attribute 'execution_model'"); auto tblgen_fn = getProperties().fn; (void)tblgen_fn; if (!tblgen_fn) return emitError(loc, "'spirv.EntryPoint' op requires attribute 'fn'"); auto tblgen_interface = getProperties().interface; (void)tblgen_interface; if (!tblgen_interface) return emitError(loc, "'spirv.EntryPoint' op requires attribute 'interface'"); if (tblgen_execution_model && !((::llvm::isa<::mlir::spirv::ExecutionModelAttr>(tblgen_execution_model)))) return emitError(loc, "'spirv.EntryPoint' op attribute 'execution_model' failed to satisfy constraint: valid SPIR-V ExecutionModel"); if (tblgen_fn && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_fn)))) return emitError(loc, "'spirv.EntryPoint' op attribute 'fn' failed to satisfy constraint: flat symbol reference attribute"); if (tblgen_interface && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_interface))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_interface), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) return emitError(loc, "'spirv.EntryPoint' op attribute 'interface' failed to satisfy constraint: symbol ref array attribute"); return ::mlir::success(); } ::llvm::LogicalResult EntryPointOp::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.execution_model; auto attr = dict.get("execution_model"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_model` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.fn; auto attr = dict.get("fn"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `fn` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.interface; auto attr = dict.get("interface"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `interface` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute EntryPointOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_model; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_model", propStorage)); } { const auto &propStorage = prop.fn; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("fn", propStorage)); } { const auto &propStorage = prop.interface; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("interface", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code EntryPointOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_model.getAsOpaquePointer()), llvm::hash_value(prop.fn.getAsOpaquePointer()), llvm::hash_value(prop.interface.getAsOpaquePointer())); } std::optional EntryPointOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_model") return prop.execution_model; if (name == "fn") return prop.fn; if (name == "interface") return prop.interface; return std::nullopt; } void EntryPointOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_model") { prop.execution_model = ::llvm::dyn_cast_or_null>(value); return; } if (name == "fn") { prop.fn = ::llvm::dyn_cast_or_null>(value); return; } if (name == "interface") { prop.interface = ::llvm::dyn_cast_or_null>(value); return; } } void EntryPointOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_model) attrs.append("execution_model", prop.execution_model); if (prop.fn) attrs.append("fn", prop.fn); if (prop.interface) attrs.append("interface", prop.interface); } ::llvm::LogicalResult EntryPointOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionModelAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps11(attr, "execution_model", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getFnAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(attr, "fn", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getInterfaceAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps12(attr, "interface", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult EntryPointOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_model))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.fn))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.interface))) return ::mlir::failure(); return ::mlir::success(); } void EntryPointOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_model); writer.writeAttribute(prop.fn); writer.writeAttribute(prop.interface); } ::mlir::spirv::ExecutionModel EntryPointOp::getExecutionModel() { auto attr = getExecutionModelAttr(); return attr.getValue(); } ::llvm::StringRef EntryPointOp::getFn() { auto attr = getFnAttr(); return attr.getValue(); } ::mlir::ArrayAttr EntryPointOp::getInterface() { auto attr = getInterfaceAttr(); return attr; } void EntryPointOp::setExecutionModel(::mlir::spirv::ExecutionModel attrValue) { getProperties().execution_model = ::mlir::spirv::ExecutionModelAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void EntryPointOp::setFn(::llvm::StringRef attrValue) { getProperties().fn = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } EntryPointOp EntryPointOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, spirv::ExecutionModel executionModel, spirv::FuncOp function, ArrayRef interfaceVars) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(executionModel), std::forward(function), std::forward(interfaceVars)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EntryPointOp EntryPointOp::create(::mlir::ImplicitLocOpBuilder &builder, spirv::ExecutionModel executionModel, spirv::FuncOp function, ArrayRef interfaceVars) { return create(builder, builder.getLoc(), std::forward(executionModel), std::forward(function), std::forward(interfaceVars)); } void EntryPointOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ExecutionModelAttr execution_model, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { odsState.getOrAddProperties().execution_model = execution_model; odsState.getOrAddProperties().fn = fn; odsState.getOrAddProperties().interface = interface; } EntryPointOp EntryPointOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ExecutionModelAttr execution_model, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_model), std::forward(fn), std::forward(interface)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EntryPointOp EntryPointOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ExecutionModelAttr execution_model, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { return create(builder, builder.getLoc(), std::forward(execution_model), std::forward(fn), std::forward(interface)); } void EntryPointOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ExecutionModelAttr execution_model, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { odsState.getOrAddProperties().execution_model = execution_model; odsState.getOrAddProperties().fn = fn; odsState.getOrAddProperties().interface = interface; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } EntryPointOp EntryPointOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ExecutionModelAttr execution_model, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_model), std::forward(fn), std::forward(interface)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EntryPointOp EntryPointOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ExecutionModelAttr execution_model, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_model), std::forward(fn), std::forward(interface)); } void EntryPointOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ExecutionModel execution_model, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { odsState.getOrAddProperties().execution_model = ::mlir::spirv::ExecutionModelAttr::get(odsBuilder.getContext(), execution_model); odsState.getOrAddProperties().fn = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), fn); odsState.getOrAddProperties().interface = interface; } EntryPointOp EntryPointOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ExecutionModel execution_model, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_model), std::forward(fn), std::forward(interface)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EntryPointOp EntryPointOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ExecutionModel execution_model, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { return create(builder, builder.getLoc(), std::forward(execution_model), std::forward(fn), std::forward(interface)); } void EntryPointOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ExecutionModel execution_model, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { odsState.getOrAddProperties().execution_model = ::mlir::spirv::ExecutionModelAttr::get(odsBuilder.getContext(), execution_model); odsState.getOrAddProperties().fn = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), fn); odsState.getOrAddProperties().interface = interface; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } EntryPointOp EntryPointOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ExecutionModel execution_model, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_model), std::forward(fn), std::forward(interface)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EntryPointOp EntryPointOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ExecutionModel execution_model, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_model), std::forward(fn), std::forward(interface)); } void EntryPointOp::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(); ::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."); } } EntryPointOp EntryPointOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EntryPointOp EntryPointOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void EntryPointOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } EntryPointOp EntryPointOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } EntryPointOp EntryPointOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult EntryPointOp::verifyInvariantsImpl() { auto tblgen_execution_model = getProperties().execution_model; (void)tblgen_execution_model; if (!tblgen_execution_model) return emitOpError("requires attribute 'execution_model'"); auto tblgen_fn = getProperties().fn; (void)tblgen_fn; if (!tblgen_fn) return emitOpError("requires attribute 'fn'"); auto tblgen_interface = getProperties().interface; (void)tblgen_interface; if (!tblgen_interface) return emitOpError("requires attribute 'interface'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps11(*this, tblgen_execution_model, "execution_model"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(*this, tblgen_fn, "fn"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps12(*this, tblgen_interface, "interface"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult EntryPointOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult EntryPointOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.execution_model; auto execution_modelAttrName = ::mlir::StringAttr::get(ctx, "execution_model"); auto attr = dict.get(execution_modelAttrName); usedKeys.insert(execution_modelAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for execution_model in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_model` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.fn; auto fnAttrName = ::mlir::StringAttr::get(ctx, "fn"); auto attr = dict.get(fnAttrName); usedKeys.insert(fnAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for fn in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `fn` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.interface; auto interfaceAttrName = ::mlir::StringAttr::get(ctx, "interface"); auto attr = dict.get(interfaceAttrName); usedKeys.insert(interfaceAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for interface in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `interface` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::EntryPointOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::EntryPointOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ExecutionModeIdOp definitions //===----------------------------------------------------------------------===// namespace detail { ExecutionModeIdOpGenericAdaptorBase::ExecutionModeIdOpGenericAdaptorBase(ExecutionModeIdOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::llvm::StringRef ExecutionModeIdOpGenericAdaptorBase::getFn() { auto attr = getFnAttr(); return attr.getValue(); } ::mlir::spirv::ExecutionMode ExecutionModeIdOpGenericAdaptorBase::getExecutionMode() { auto attr = getExecutionModeAttr(); return attr.getValue(); } ::mlir::ArrayAttr ExecutionModeIdOpGenericAdaptorBase::getValues() { auto attr = getValuesAttr(); return attr; } } // namespace detail ExecutionModeIdOpAdaptor::ExecutionModeIdOpAdaptor(ExecutionModeIdOp op) : ExecutionModeIdOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ExecutionModeIdOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_mode = getProperties().execution_mode; (void)tblgen_execution_mode; if (!tblgen_execution_mode) return emitError(loc, "'spirv.ExecutionModeId' op requires attribute 'execution_mode'"); auto tblgen_fn = getProperties().fn; (void)tblgen_fn; if (!tblgen_fn) return emitError(loc, "'spirv.ExecutionModeId' op requires attribute 'fn'"); auto tblgen_values = getProperties().values; (void)tblgen_values; if (!tblgen_values) return emitError(loc, "'spirv.ExecutionModeId' op requires attribute 'values'"); if (tblgen_fn && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_fn)))) return emitError(loc, "'spirv.ExecutionModeId' op attribute 'fn' failed to satisfy constraint: flat symbol reference attribute"); if (tblgen_execution_mode && !((::llvm::isa<::mlir::spirv::ExecutionModeAttr>(tblgen_execution_mode)))) return emitError(loc, "'spirv.ExecutionModeId' op attribute 'execution_mode' failed to satisfy constraint: valid SPIR-V ExecutionMode"); if (tblgen_values && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_values))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_values), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) return emitError(loc, "'spirv.ExecutionModeId' op attribute 'values' failed to satisfy constraint: symbol ref array attribute"); return ::mlir::success(); } ::llvm::LogicalResult ExecutionModeIdOp::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.execution_mode; auto attr = dict.get("execution_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_mode` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.fn; auto attr = dict.get("fn"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `fn` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.values; auto attr = dict.get("values"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `values` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ExecutionModeIdOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_mode", propStorage)); } { const auto &propStorage = prop.fn; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("fn", propStorage)); } { const auto &propStorage = prop.values; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("values", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ExecutionModeIdOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_mode.getAsOpaquePointer()), llvm::hash_value(prop.fn.getAsOpaquePointer()), llvm::hash_value(prop.values.getAsOpaquePointer())); } std::optional ExecutionModeIdOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_mode") return prop.execution_mode; if (name == "fn") return prop.fn; if (name == "values") return prop.values; return std::nullopt; } void ExecutionModeIdOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_mode") { prop.execution_mode = ::llvm::dyn_cast_or_null>(value); return; } if (name == "fn") { prop.fn = ::llvm::dyn_cast_or_null>(value); return; } if (name == "values") { prop.values = ::llvm::dyn_cast_or_null>(value); return; } } void ExecutionModeIdOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_mode) attrs.append("execution_mode", prop.execution_mode); if (prop.fn) attrs.append("fn", prop.fn); if (prop.values) attrs.append("values", prop.values); } ::llvm::LogicalResult ExecutionModeIdOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps13(attr, "execution_mode", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getFnAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(attr, "fn", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getValuesAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps12(attr, "values", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ExecutionModeIdOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_mode))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.fn))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.values))) return ::mlir::failure(); return ::mlir::success(); } void ExecutionModeIdOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_mode); writer.writeAttribute(prop.fn); writer.writeAttribute(prop.values); } ::llvm::StringRef ExecutionModeIdOp::getFn() { auto attr = getFnAttr(); return attr.getValue(); } ::mlir::spirv::ExecutionMode ExecutionModeIdOp::getExecutionMode() { auto attr = getExecutionModeAttr(); return attr.getValue(); } ::mlir::ArrayAttr ExecutionModeIdOp::getValues() { auto attr = getValuesAttr(); return attr; } void ExecutionModeIdOp::setFn(::llvm::StringRef attrValue) { getProperties().fn = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ExecutionModeIdOp::setExecutionMode(::mlir::spirv::ExecutionMode attrValue) { getProperties().execution_mode = ::mlir::spirv::ExecutionModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ExecutionModeIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, spirv::FuncOp function, spirv::ExecutionMode executionMode, ArrayRef params) { build(odsBuilder, odsState, SymbolRefAttr::get(function), ExecutionModeAttr::get(odsBuilder.getContext(), executionMode), odsBuilder.getArrayAttr(params)); } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, spirv::FuncOp function, spirv::ExecutionMode executionMode, ArrayRef params) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(function), std::forward(executionMode), std::forward(params)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::ImplicitLocOpBuilder &builder, spirv::FuncOp function, spirv::ExecutionMode executionMode, ArrayRef params) { return create(builder, builder.getLoc(), std::forward(function), std::forward(executionMode), std::forward(params)); } void ExecutionModeIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { odsState.getOrAddProperties().fn = fn; odsState.getOrAddProperties().execution_mode = execution_mode; odsState.getOrAddProperties().values = values; } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(fn), std::forward(execution_mode), std::forward(values)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { return create(builder, builder.getLoc(), std::forward(fn), std::forward(execution_mode), std::forward(values)); } void ExecutionModeIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { odsState.getOrAddProperties().fn = fn; odsState.getOrAddProperties().execution_mode = execution_mode; odsState.getOrAddProperties().values = values; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(fn), std::forward(execution_mode), std::forward(values)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(fn), std::forward(execution_mode), std::forward(values)); } void ExecutionModeIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { odsState.getOrAddProperties().fn = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), fn); odsState.getOrAddProperties().execution_mode = ::mlir::spirv::ExecutionModeAttr::get(odsBuilder.getContext(), execution_mode); odsState.getOrAddProperties().values = values; } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(fn), std::forward(execution_mode), std::forward(values)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { return create(builder, builder.getLoc(), std::forward(fn), std::forward(execution_mode), std::forward(values)); } void ExecutionModeIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { odsState.getOrAddProperties().fn = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), fn); odsState.getOrAddProperties().execution_mode = ::mlir::spirv::ExecutionModeAttr::get(odsBuilder.getContext(), execution_mode); odsState.getOrAddProperties().values = values; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(fn), std::forward(execution_mode), std::forward(values)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(fn), std::forward(execution_mode), std::forward(values)); } void ExecutionModeIdOp::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(); ::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."); } } ExecutionModeIdOp ExecutionModeIdOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeIdOp ExecutionModeIdOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ExecutionModeIdOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ExecutionModeIdOp ExecutionModeIdOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeIdOp ExecutionModeIdOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ExecutionModeIdOp::verifyInvariantsImpl() { auto tblgen_execution_mode = getProperties().execution_mode; (void)tblgen_execution_mode; if (!tblgen_execution_mode) return emitOpError("requires attribute 'execution_mode'"); auto tblgen_fn = getProperties().fn; (void)tblgen_fn; if (!tblgen_fn) return emitOpError("requires attribute 'fn'"); auto tblgen_values = getProperties().values; (void)tblgen_values; if (!tblgen_values) return emitOpError("requires attribute 'values'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(*this, tblgen_fn, "fn"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps13(*this, tblgen_execution_mode, "execution_mode"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps12(*this, tblgen_values, "values"))) return ::mlir::failure(); return ::mlir::success(); } ::llvm::LogicalResult ExecutionModeIdOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult ExecutionModeIdOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.fn; auto fnAttrName = ::mlir::StringAttr::get(ctx, "fn"); auto attr = dict.get(fnAttrName); usedKeys.insert(fnAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for fn in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `fn` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.execution_mode; auto execution_modeAttrName = ::mlir::StringAttr::get(ctx, "execution_mode"); auto attr = dict.get(execution_modeAttrName); usedKeys.insert(execution_modeAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for execution_mode in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_mode` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.values; auto valuesAttrName = ::mlir::StringAttr::get(ctx, "values"); auto attr = dict.get(valuesAttrName); usedKeys.insert(valuesAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for values in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `values` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ExecutionModeIdOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ExecutionModeIdOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ExecutionModeOp definitions //===----------------------------------------------------------------------===// namespace detail { ExecutionModeOpGenericAdaptorBase::ExecutionModeOpGenericAdaptorBase(ExecutionModeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::llvm::StringRef ExecutionModeOpGenericAdaptorBase::getFn() { auto attr = getFnAttr(); return attr.getValue(); } ::mlir::spirv::ExecutionMode ExecutionModeOpGenericAdaptorBase::getExecutionMode() { auto attr = getExecutionModeAttr(); return attr.getValue(); } ::mlir::ArrayAttr ExecutionModeOpGenericAdaptorBase::getValues() { auto attr = getValuesAttr(); return attr; } } // namespace detail ExecutionModeOpAdaptor::ExecutionModeOpAdaptor(ExecutionModeOp op) : ExecutionModeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ExecutionModeOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_mode = getProperties().execution_mode; (void)tblgen_execution_mode; if (!tblgen_execution_mode) return emitError(loc, "'spirv.ExecutionMode' op requires attribute 'execution_mode'"); auto tblgen_fn = getProperties().fn; (void)tblgen_fn; if (!tblgen_fn) return emitError(loc, "'spirv.ExecutionMode' op requires attribute 'fn'"); auto tblgen_values = getProperties().values; (void)tblgen_values; if (!tblgen_values) return emitError(loc, "'spirv.ExecutionMode' op requires attribute 'values'"); if (tblgen_fn && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_fn)))) return emitError(loc, "'spirv.ExecutionMode' op attribute 'fn' failed to satisfy constraint: flat symbol reference attribute"); if (tblgen_execution_mode && !((::llvm::isa<::mlir::spirv::ExecutionModeAttr>(tblgen_execution_mode)))) return emitError(loc, "'spirv.ExecutionMode' op attribute 'execution_mode' failed to satisfy constraint: valid SPIR-V ExecutionMode"); if (tblgen_values && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_values))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_values), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) return emitError(loc, "'spirv.ExecutionMode' op attribute 'values' failed to satisfy constraint: 32-bit integer array attribute"); return ::mlir::success(); } ::llvm::LogicalResult ExecutionModeOp::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.execution_mode; auto attr = dict.get("execution_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_mode` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.fn; auto attr = dict.get("fn"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `fn` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.values; auto attr = dict.get("values"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `values` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ExecutionModeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_mode", propStorage)); } { const auto &propStorage = prop.fn; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("fn", propStorage)); } { const auto &propStorage = prop.values; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("values", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ExecutionModeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_mode.getAsOpaquePointer()), llvm::hash_value(prop.fn.getAsOpaquePointer()), llvm::hash_value(prop.values.getAsOpaquePointer())); } std::optional ExecutionModeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_mode") return prop.execution_mode; if (name == "fn") return prop.fn; if (name == "values") return prop.values; return std::nullopt; } void ExecutionModeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_mode") { prop.execution_mode = ::llvm::dyn_cast_or_null>(value); return; } if (name == "fn") { prop.fn = ::llvm::dyn_cast_or_null>(value); return; } if (name == "values") { prop.values = ::llvm::dyn_cast_or_null>(value); return; } } void ExecutionModeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_mode) attrs.append("execution_mode", prop.execution_mode); if (prop.fn) attrs.append("fn", prop.fn); if (prop.values) attrs.append("values", prop.values); } ::llvm::LogicalResult ExecutionModeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps13(attr, "execution_mode", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getFnAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(attr, "fn", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getValuesAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(attr, "values", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ExecutionModeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_mode))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.fn))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.values))) return ::mlir::failure(); return ::mlir::success(); } void ExecutionModeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_mode); writer.writeAttribute(prop.fn); writer.writeAttribute(prop.values); } ::llvm::StringRef ExecutionModeOp::getFn() { auto attr = getFnAttr(); return attr.getValue(); } ::mlir::spirv::ExecutionMode ExecutionModeOp::getExecutionMode() { auto attr = getExecutionModeAttr(); return attr.getValue(); } ::mlir::ArrayAttr ExecutionModeOp::getValues() { auto attr = getValuesAttr(); return attr; } void ExecutionModeOp::setFn(::llvm::StringRef attrValue) { getProperties().fn = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ExecutionModeOp::setExecutionMode(::mlir::spirv::ExecutionMode attrValue) { getProperties().execution_mode = ::mlir::spirv::ExecutionModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } ExecutionModeOp ExecutionModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, spirv::FuncOp function, spirv::ExecutionMode executionMode, ArrayRef params) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(function), std::forward(executionMode), std::forward(params)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeOp ExecutionModeOp::create(::mlir::ImplicitLocOpBuilder &builder, spirv::FuncOp function, spirv::ExecutionMode executionMode, ArrayRef params) { return create(builder, builder.getLoc(), std::forward(function), std::forward(executionMode), std::forward(params)); } void ExecutionModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { odsState.getOrAddProperties().fn = fn; odsState.getOrAddProperties().execution_mode = execution_mode; odsState.getOrAddProperties().values = values; } ExecutionModeOp ExecutionModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(fn), std::forward(execution_mode), std::forward(values)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeOp ExecutionModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { return create(builder, builder.getLoc(), std::forward(fn), std::forward(execution_mode), std::forward(values)); } void ExecutionModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { odsState.getOrAddProperties().fn = fn; odsState.getOrAddProperties().execution_mode = execution_mode; odsState.getOrAddProperties().values = values; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ExecutionModeOp ExecutionModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(fn), std::forward(execution_mode), std::forward(values)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeOp ExecutionModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::spirv::ExecutionModeAttr execution_mode, ::mlir::ArrayAttr values) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(fn), std::forward(execution_mode), std::forward(values)); } void ExecutionModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { odsState.getOrAddProperties().fn = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), fn); odsState.getOrAddProperties().execution_mode = ::mlir::spirv::ExecutionModeAttr::get(odsBuilder.getContext(), execution_mode); odsState.getOrAddProperties().values = values; } ExecutionModeOp ExecutionModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(fn), std::forward(execution_mode), std::forward(values)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeOp ExecutionModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { return create(builder, builder.getLoc(), std::forward(fn), std::forward(execution_mode), std::forward(values)); } void ExecutionModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { odsState.getOrAddProperties().fn = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), fn); odsState.getOrAddProperties().execution_mode = ::mlir::spirv::ExecutionModeAttr::get(odsBuilder.getContext(), execution_mode); odsState.getOrAddProperties().values = values; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ExecutionModeOp ExecutionModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(fn), std::forward(execution_mode), std::forward(values)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeOp ExecutionModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::spirv::ExecutionMode execution_mode, ::mlir::ArrayAttr values) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(fn), std::forward(execution_mode), std::forward(values)); } void ExecutionModeOp::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(); ::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."); } } ExecutionModeOp ExecutionModeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeOp ExecutionModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ExecutionModeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ExecutionModeOp ExecutionModeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExecutionModeOp ExecutionModeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ExecutionModeOp::verifyInvariantsImpl() { auto tblgen_execution_mode = getProperties().execution_mode; (void)tblgen_execution_mode; if (!tblgen_execution_mode) return emitOpError("requires attribute 'execution_mode'"); auto tblgen_fn = getProperties().fn; (void)tblgen_fn; if (!tblgen_fn) return emitOpError("requires attribute 'fn'"); auto tblgen_values = getProperties().values; (void)tblgen_values; if (!tblgen_values) return emitOpError("requires attribute 'values'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(*this, tblgen_fn, "fn"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps13(*this, tblgen_execution_mode, "execution_mode"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(*this, tblgen_values, "values"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult ExecutionModeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult ExecutionModeOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.fn; auto fnAttrName = ::mlir::StringAttr::get(ctx, "fn"); auto attr = dict.get(fnAttrName); usedKeys.insert(fnAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for fn in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `fn` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.execution_mode; auto execution_modeAttrName = ::mlir::StringAttr::get(ctx, "execution_mode"); auto attr = dict.get(execution_modeAttrName); usedKeys.insert(execution_modeAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for execution_mode in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_mode` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.values; auto valuesAttrName = ::mlir::StringAttr::get(ctx, "values"); auto attr = dict.get(valuesAttrName); usedKeys.insert(valuesAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for values in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `values` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ExecutionModeOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ExecutionModeOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ExperimentalMLCallOp definitions //===----------------------------------------------------------------------===// namespace detail { ExperimentalMLCallOpGenericAdaptorBase::ExperimentalMLCallOpGenericAdaptorBase(ExperimentalMLCallOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair ExperimentalMLCallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {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 - 0) / 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 ExperimentalMLCallOpGenericAdaptorBase::getOpcode() { auto attr = getOpcodeAttr(); return attr.getValue().getZExtValue(); } } // namespace detail ExperimentalMLCallOpAdaptor::ExperimentalMLCallOpAdaptor(ExperimentalMLCallOp op) : ExperimentalMLCallOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ExperimentalMLCallOpAdaptor::verify(::mlir::Location loc) { auto tblgen_opcode = getProperties().opcode; (void)tblgen_opcode; if (!tblgen_opcode) return emitError(loc, "'spirv.ExperimentalML.Call' op requires attribute 'opcode'"); if (tblgen_opcode && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_opcode))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_opcode).getType().isSignlessInteger(32))))) return emitError(loc, "'spirv.ExperimentalML.Call' op attribute 'opcode' failed to satisfy constraint: 32-bit signless integer attribute"); return ::mlir::success(); } std::pair ExperimentalMLCallOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {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() - 0) / 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 ExperimentalMLCallOp::getParametersMutable() { auto range = getODSOperandIndexAndLength(0); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult ExperimentalMLCallOp::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.opcode; auto attr = dict.get("opcode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `opcode` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ExperimentalMLCallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.opcode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("opcode", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ExperimentalMLCallOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.opcode.getAsOpaquePointer())); } std::optional ExperimentalMLCallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "opcode") return prop.opcode; return std::nullopt; } void ExperimentalMLCallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "opcode") { prop.opcode = ::llvm::dyn_cast_or_null>(value); return; } } void ExperimentalMLCallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.opcode) attrs.append("opcode", prop.opcode); } ::llvm::LogicalResult ExperimentalMLCallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getOpcodeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(attr, "opcode", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ExperimentalMLCallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.opcode))) return ::mlir::failure(); return ::mlir::success(); } void ExperimentalMLCallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.opcode); } uint32_t ExperimentalMLCallOp::getOpcode() { auto attr = getOpcodeAttr(); return attr.getValue().getZExtValue(); } void ExperimentalMLCallOp::setOpcode(uint32_t attrValue) { getProperties().opcode = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void ExperimentalMLCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr opcode, ::mlir::ValueRange parameters) { odsState.addOperands(parameters); odsState.getOrAddProperties().opcode = opcode; odsState.addTypes(output); } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr opcode, ::mlir::ValueRange parameters) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(opcode), std::forward(parameters)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr opcode, ::mlir::ValueRange parameters) { return create(builder, builder.getLoc(), std::forward(output), std::forward(opcode), std::forward(parameters)); } void ExperimentalMLCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr opcode, ::mlir::ValueRange parameters) { odsState.addOperands(parameters); odsState.getOrAddProperties().opcode = opcode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr opcode, ::mlir::ValueRange parameters) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(opcode), std::forward(parameters)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr opcode, ::mlir::ValueRange parameters) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(opcode), std::forward(parameters)); } void ExperimentalMLCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t opcode, ::mlir::ValueRange parameters) { odsState.addOperands(parameters); odsState.getOrAddProperties().opcode = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), opcode); odsState.addTypes(output); } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t opcode, ::mlir::ValueRange parameters) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(opcode), std::forward(parameters)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t opcode, ::mlir::ValueRange parameters) { return create(builder, builder.getLoc(), std::forward(output), std::forward(opcode), std::forward(parameters)); } void ExperimentalMLCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t opcode, ::mlir::ValueRange parameters) { odsState.addOperands(parameters); odsState.getOrAddProperties().opcode = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), opcode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t opcode, ::mlir::ValueRange parameters) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(opcode), std::forward(parameters)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t opcode, ::mlir::ValueRange parameters) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(opcode), std::forward(parameters)); } void ExperimentalMLCallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { odsState.addOperands(operands); odsState.addAttributes(attributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } ExperimentalMLCallOp ExperimentalMLCallOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExperimentalMLCallOp ExperimentalMLCallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ExperimentalMLCallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { odsState.addOperands(operands); odsState.useProperties(const_cast(properties)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ExperimentalMLCallOp ExperimentalMLCallOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ExperimentalMLCallOp ExperimentalMLCallOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ExperimentalMLCallOp::verifyInvariantsImpl() { auto tblgen_opcode = getProperties().opcode; (void)tblgen_opcode; if (!tblgen_opcode) return emitOpError("requires attribute 'opcode'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(*this, tblgen_opcode, "opcode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps19(*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_SPIRVOps20(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ExperimentalMLCallOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult ExperimentalMLCallOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr opcodeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> parametersOperands; ::llvm::SMLoc parametersOperandsLoc; (void)parametersOperandsLoc; ::llvm::ArrayRef<::mlir::Type> parametersTypes; ::llvm::ArrayRef<::mlir::Type> outputTypes; if (parser.parseKeyword("opcode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(opcodeAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (opcodeAttr) result.getOrAddProperties().opcode = opcodeAttr; if (parser.parseComma()) return ::mlir::failure(); parametersOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(parametersOperands)) 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::FunctionType parameters__output_functionType; if (parser.parseType(parameters__output_functionType)) return ::mlir::failure(); parametersTypes = parameters__output_functionType.getInputs(); outputTypes = parameters__output_functionType.getResults(); result.addTypes(outputTypes); if (parser.resolveOperands(parametersOperands, parametersTypes, parametersOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ExperimentalMLCallOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "opcode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getOpcodeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getParameters(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("opcode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter.printFunctionalType(getParameters().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getOutput().getType())); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ExperimentalMLCallOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ExperimentalMLCallOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FAddOp definitions //===----------------------------------------------------------------------===// namespace detail { FAddOpGenericAdaptorBase::FAddOpGenericAdaptorBase(FAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FAddOpAdaptor::FAddOpAdaptor(FAddOp op) : FAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FAddOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FAddOp::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 FAddOp::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 FAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FAddOp::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); } FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FAddOp FAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FAddOp::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); } FAddOp FAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FAddOp::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(FAddOp::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)."); } } FAddOp FAddOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FAddOp FAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FAddOp FAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FAddOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FAddOp::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)."); } } FAddOp FAddOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FAddOp FAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FAddOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*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_SPIRVOps21(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult FAddOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FAddOp::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 FAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 FAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FAddOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FConvertOp definitions //===----------------------------------------------------------------------===// namespace detail { FConvertOpGenericAdaptorBase::FConvertOpGenericAdaptorBase(FConvertOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FConvertOpAdaptor::FConvertOpAdaptor(FConvertOp op) : FConvertOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FConvertOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FConvertOp::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 FConvertOp::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 FConvertOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FConvertOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FConvertOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FConvertOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FConvertOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FConvertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } FConvertOp FConvertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FConvertOp FConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void FConvertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FConvertOp FConvertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FConvertOp FConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void FConvertOp::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); } FConvertOp FConvertOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FConvertOp FConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FConvertOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FConvertOp FConvertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FConvertOp FConvertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FConvertOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps13(*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_SPIRVOps13(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult FConvertOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult FConvertOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FConvertOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void FConvertOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FConvertOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FDivOp definitions //===----------------------------------------------------------------------===// namespace detail { FDivOpGenericAdaptorBase::FDivOpGenericAdaptorBase(FDivOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FDivOpAdaptor::FDivOpAdaptor(FDivOp op) : FDivOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FDivOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FDivOp::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 FDivOp::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 FDivOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FDivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FDivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FDivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FDivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FDivOp::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); } FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FDivOp FDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FDivOp::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); } FDivOp FDivOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FDivOp::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(FDivOp::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)."); } } FDivOp FDivOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FDivOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FDivOp FDivOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FDivOp FDivOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FDivOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FDivOp::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)."); } } FDivOp FDivOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FDivOp FDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FDivOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*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_SPIRVOps21(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult FDivOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FDivOp::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 FDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 FDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FDivOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FModOp definitions //===----------------------------------------------------------------------===// namespace detail { FModOpGenericAdaptorBase::FModOpGenericAdaptorBase(FModOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FModOpAdaptor::FModOpAdaptor(FModOp op) : FModOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FModOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FModOp::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 FModOp::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 FModOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FModOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FModOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FModOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FModOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FModOp FModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FModOp FModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FModOp::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); } FModOp FModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FModOp FModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FModOp FModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FModOp FModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FModOp::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); } FModOp FModOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FModOp FModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FModOp::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(FModOp::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)."); } } FModOp FModOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FModOp FModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FModOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FModOp FModOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FModOp FModOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FModOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FModOp::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)."); } } FModOp FModOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FModOp FModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FModOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult FModOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FModOp::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 FModOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FModOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 FModOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FModOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FMulOp definitions //===----------------------------------------------------------------------===// namespace detail { FMulOpGenericAdaptorBase::FMulOpGenericAdaptorBase(FMulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FMulOpAdaptor::FMulOpAdaptor(FMulOp op) : FMulOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FMulOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FMulOp::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 FMulOp::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 FMulOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FMulOp::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); } FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FMulOp FMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FMulOp::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); } FMulOp FMulOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FMulOp::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(FMulOp::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)."); } } FMulOp FMulOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FMulOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FMulOp FMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FMulOp FMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FMulOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FMulOp::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)."); } } FMulOp FMulOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FMulOp FMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FMulOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*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_SPIRVOps21(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult FMulOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FMulOp::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 FMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 FMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FMulOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FNegateOp definitions //===----------------------------------------------------------------------===// namespace detail { FNegateOpGenericAdaptorBase::FNegateOpGenericAdaptorBase(FNegateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FNegateOpAdaptor::FNegateOpAdaptor(FNegateOp op) : FNegateOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FNegateOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FNegateOp::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 FNegateOp::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 FNegateOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FNegateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FNegateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FNegateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FNegateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } FNegateOp FNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FNegateOp FNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void FNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FNegateOp::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); } FNegateOp FNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FNegateOp FNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void FNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FNegateOp FNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FNegateOp FNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void FNegateOp::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); } FNegateOp FNegateOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FNegateOp FNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FNegateOp::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(FNegateOp::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)."); } } FNegateOp FNegateOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FNegateOp FNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FNegateOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FNegateOp FNegateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FNegateOp FNegateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FNegateOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FNegateOp::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)."); } } FNegateOp FNegateOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FNegateOp FNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FNegateOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*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_SPIRVOps21(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {operand, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult FNegateOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FNegateOp::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 FNegateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, resultTypes[0], allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FNegateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 FNegateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FNegateOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FOrdEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { FOrdEqualOpGenericAdaptorBase::FOrdEqualOpGenericAdaptorBase(FOrdEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FOrdEqualOpAdaptor::FOrdEqualOpAdaptor(FOrdEqualOp op) : FOrdEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FOrdEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FOrdEqualOp::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 FOrdEqualOp::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 FOrdEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FOrdEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FOrdEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FOrdEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FOrdEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FOrdEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FOrdEqualOp FOrdEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdEqualOp FOrdEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FOrdEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdEqualOp::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); } FOrdEqualOp FOrdEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdEqualOp FOrdEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FOrdEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FOrdEqualOp FOrdEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdEqualOp FOrdEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FOrdEqualOp::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); } FOrdEqualOp FOrdEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdEqualOp FOrdEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FOrdEqualOp::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(FOrdEqualOp::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)."); } } FOrdEqualOp FOrdEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdEqualOp FOrdEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FOrdEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FOrdEqualOp FOrdEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdEqualOp FOrdEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FOrdEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdEqualOp::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)."); } } FOrdEqualOp FOrdEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdEqualOp FOrdEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FOrdEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FOrdEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FOrdEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FOrdEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FOrdEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FOrdEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FOrdEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FOrdGreaterThanEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { FOrdGreaterThanEqualOpGenericAdaptorBase::FOrdGreaterThanEqualOpGenericAdaptorBase(FOrdGreaterThanEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FOrdGreaterThanEqualOpAdaptor::FOrdGreaterThanEqualOpAdaptor(FOrdGreaterThanEqualOp op) : FOrdGreaterThanEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FOrdGreaterThanEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FOrdGreaterThanEqualOp::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 FOrdGreaterThanEqualOp::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 FOrdGreaterThanEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FOrdGreaterThanEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FOrdGreaterThanEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FOrdGreaterThanEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FOrdGreaterThanEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FOrdGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FOrdGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdGreaterThanEqualOp::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); } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FOrdGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FOrdGreaterThanEqualOp::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); } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FOrdGreaterThanEqualOp::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(FOrdGreaterThanEqualOp::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)."); } } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FOrdGreaterThanEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FOrdGreaterThanEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdGreaterThanEqualOp::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)."); } } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanEqualOp FOrdGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FOrdGreaterThanEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FOrdGreaterThanEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FOrdGreaterThanEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FOrdGreaterThanEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FOrdGreaterThanEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FOrdGreaterThanEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FOrdGreaterThanEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FOrdGreaterThanOp definitions //===----------------------------------------------------------------------===// namespace detail { FOrdGreaterThanOpGenericAdaptorBase::FOrdGreaterThanOpGenericAdaptorBase(FOrdGreaterThanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FOrdGreaterThanOpAdaptor::FOrdGreaterThanOpAdaptor(FOrdGreaterThanOp op) : FOrdGreaterThanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FOrdGreaterThanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FOrdGreaterThanOp::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 FOrdGreaterThanOp::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 FOrdGreaterThanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FOrdGreaterThanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FOrdGreaterThanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FOrdGreaterThanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FOrdGreaterThanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FOrdGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FOrdGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdGreaterThanOp::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); } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FOrdGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FOrdGreaterThanOp::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); } FOrdGreaterThanOp FOrdGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FOrdGreaterThanOp::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(FOrdGreaterThanOp::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)."); } } FOrdGreaterThanOp FOrdGreaterThanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FOrdGreaterThanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FOrdGreaterThanOp FOrdGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanOp FOrdGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FOrdGreaterThanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdGreaterThanOp::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)."); } } FOrdGreaterThanOp FOrdGreaterThanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdGreaterThanOp FOrdGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FOrdGreaterThanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FOrdGreaterThanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FOrdGreaterThanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FOrdGreaterThanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FOrdGreaterThanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FOrdGreaterThanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FOrdGreaterThanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FOrdLessThanEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { FOrdLessThanEqualOpGenericAdaptorBase::FOrdLessThanEqualOpGenericAdaptorBase(FOrdLessThanEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FOrdLessThanEqualOpAdaptor::FOrdLessThanEqualOpAdaptor(FOrdLessThanEqualOp op) : FOrdLessThanEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FOrdLessThanEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FOrdLessThanEqualOp::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 FOrdLessThanEqualOp::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 FOrdLessThanEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FOrdLessThanEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FOrdLessThanEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FOrdLessThanEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FOrdLessThanEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FOrdLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FOrdLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdLessThanEqualOp::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); } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FOrdLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FOrdLessThanEqualOp::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); } FOrdLessThanEqualOp FOrdLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FOrdLessThanEqualOp::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(FOrdLessThanEqualOp::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)."); } } FOrdLessThanEqualOp FOrdLessThanEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FOrdLessThanEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FOrdLessThanEqualOp FOrdLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanEqualOp FOrdLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FOrdLessThanEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdLessThanEqualOp::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)."); } } FOrdLessThanEqualOp FOrdLessThanEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanEqualOp FOrdLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FOrdLessThanEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FOrdLessThanEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FOrdLessThanEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FOrdLessThanEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FOrdLessThanEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FOrdLessThanEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FOrdLessThanEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FOrdLessThanOp definitions //===----------------------------------------------------------------------===// namespace detail { FOrdLessThanOpGenericAdaptorBase::FOrdLessThanOpGenericAdaptorBase(FOrdLessThanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FOrdLessThanOpAdaptor::FOrdLessThanOpAdaptor(FOrdLessThanOp op) : FOrdLessThanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FOrdLessThanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FOrdLessThanOp::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 FOrdLessThanOp::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 FOrdLessThanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FOrdLessThanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FOrdLessThanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FOrdLessThanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FOrdLessThanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FOrdLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FOrdLessThanOp FOrdLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanOp FOrdLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FOrdLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdLessThanOp::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); } FOrdLessThanOp FOrdLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanOp FOrdLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FOrdLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FOrdLessThanOp FOrdLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanOp FOrdLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FOrdLessThanOp::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); } FOrdLessThanOp FOrdLessThanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanOp FOrdLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FOrdLessThanOp::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(FOrdLessThanOp::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)."); } } FOrdLessThanOp FOrdLessThanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanOp FOrdLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FOrdLessThanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FOrdLessThanOp FOrdLessThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanOp FOrdLessThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FOrdLessThanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdLessThanOp::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)."); } } FOrdLessThanOp FOrdLessThanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdLessThanOp FOrdLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FOrdLessThanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FOrdLessThanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FOrdLessThanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FOrdLessThanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FOrdLessThanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FOrdLessThanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FOrdLessThanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FOrdNotEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { FOrdNotEqualOpGenericAdaptorBase::FOrdNotEqualOpGenericAdaptorBase(FOrdNotEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FOrdNotEqualOpAdaptor::FOrdNotEqualOpAdaptor(FOrdNotEqualOp op) : FOrdNotEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FOrdNotEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FOrdNotEqualOp::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 FOrdNotEqualOp::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 FOrdNotEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FOrdNotEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FOrdNotEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FOrdNotEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FOrdNotEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FOrdNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FOrdNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdNotEqualOp::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); } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FOrdNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FOrdNotEqualOp::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); } FOrdNotEqualOp FOrdNotEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FOrdNotEqualOp::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(FOrdNotEqualOp::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)."); } } FOrdNotEqualOp FOrdNotEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FOrdNotEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FOrdNotEqualOp FOrdNotEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdNotEqualOp FOrdNotEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FOrdNotEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FOrdNotEqualOp::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)."); } } FOrdNotEqualOp FOrdNotEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FOrdNotEqualOp FOrdNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FOrdNotEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FOrdNotEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FOrdNotEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FOrdNotEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FOrdNotEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FOrdNotEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FOrdNotEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FRemOp definitions //===----------------------------------------------------------------------===// namespace detail { FRemOpGenericAdaptorBase::FRemOpGenericAdaptorBase(FRemOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FRemOpAdaptor::FRemOpAdaptor(FRemOp op) : FRemOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FRemOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FRemOp::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 FRemOp::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 FRemOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FRemOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FRemOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FRemOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FRemOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FRemOp::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); } FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FRemOp FRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FRemOp::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); } FRemOp FRemOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FRemOp::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(FRemOp::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)."); } } FRemOp FRemOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FRemOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FRemOp FRemOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FRemOp FRemOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FRemOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FRemOp::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)."); } } FRemOp FRemOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FRemOp FRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FRemOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult FRemOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FRemOp::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 FRemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FRemOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 FRemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FRemOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FSubOp definitions //===----------------------------------------------------------------------===// namespace detail { FSubOpGenericAdaptorBase::FSubOpGenericAdaptorBase(FSubOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FSubOpAdaptor::FSubOpAdaptor(FSubOp op) : FSubOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FSubOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FSubOp::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 FSubOp::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 FSubOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FSubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FSubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FSubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FSubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FSubOp::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); } FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FSubOp FSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FSubOp::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); } FSubOp FSubOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FSubOp::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(FSubOp::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)."); } } FSubOp FSubOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FSubOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FSubOp FSubOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FSubOp FSubOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FSubOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FSubOp::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)."); } } FSubOp FSubOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FSubOp FSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FSubOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps21(*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_SPIRVOps21(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult FSubOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FSubOp::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 FSubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FSubOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 FSubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FSubOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FUnordEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { FUnordEqualOpGenericAdaptorBase::FUnordEqualOpGenericAdaptorBase(FUnordEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FUnordEqualOpAdaptor::FUnordEqualOpAdaptor(FUnordEqualOp op) : FUnordEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FUnordEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FUnordEqualOp::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 FUnordEqualOp::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 FUnordEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FUnordEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FUnordEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FUnordEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FUnordEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FUnordEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FUnordEqualOp FUnordEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordEqualOp FUnordEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FUnordEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordEqualOp::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); } FUnordEqualOp FUnordEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordEqualOp FUnordEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FUnordEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FUnordEqualOp FUnordEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordEqualOp FUnordEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FUnordEqualOp::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); } FUnordEqualOp FUnordEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordEqualOp FUnordEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FUnordEqualOp::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(FUnordEqualOp::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)."); } } FUnordEqualOp FUnordEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordEqualOp FUnordEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FUnordEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FUnordEqualOp FUnordEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordEqualOp FUnordEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FUnordEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordEqualOp::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)."); } } FUnordEqualOp FUnordEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordEqualOp FUnordEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FUnordEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FUnordEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FUnordEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FUnordEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FUnordEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FUnordEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FUnordEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FUnordGreaterThanEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { FUnordGreaterThanEqualOpGenericAdaptorBase::FUnordGreaterThanEqualOpGenericAdaptorBase(FUnordGreaterThanEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FUnordGreaterThanEqualOpAdaptor::FUnordGreaterThanEqualOpAdaptor(FUnordGreaterThanEqualOp op) : FUnordGreaterThanEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FUnordGreaterThanEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FUnordGreaterThanEqualOp::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 FUnordGreaterThanEqualOp::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 FUnordGreaterThanEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FUnordGreaterThanEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FUnordGreaterThanEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FUnordGreaterThanEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FUnordGreaterThanEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FUnordGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FUnordGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordGreaterThanEqualOp::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); } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FUnordGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FUnordGreaterThanEqualOp::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); } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FUnordGreaterThanEqualOp::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(FUnordGreaterThanEqualOp::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)."); } } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FUnordGreaterThanEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FUnordGreaterThanEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordGreaterThanEqualOp::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)."); } } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanEqualOp FUnordGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FUnordGreaterThanEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FUnordGreaterThanEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FUnordGreaterThanEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FUnordGreaterThanEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FUnordGreaterThanEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FUnordGreaterThanEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FUnordGreaterThanEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FUnordGreaterThanOp definitions //===----------------------------------------------------------------------===// namespace detail { FUnordGreaterThanOpGenericAdaptorBase::FUnordGreaterThanOpGenericAdaptorBase(FUnordGreaterThanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FUnordGreaterThanOpAdaptor::FUnordGreaterThanOpAdaptor(FUnordGreaterThanOp op) : FUnordGreaterThanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FUnordGreaterThanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FUnordGreaterThanOp::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 FUnordGreaterThanOp::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 FUnordGreaterThanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FUnordGreaterThanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FUnordGreaterThanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FUnordGreaterThanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FUnordGreaterThanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FUnordGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FUnordGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordGreaterThanOp::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); } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FUnordGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FUnordGreaterThanOp::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); } FUnordGreaterThanOp FUnordGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FUnordGreaterThanOp::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(FUnordGreaterThanOp::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)."); } } FUnordGreaterThanOp FUnordGreaterThanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FUnordGreaterThanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FUnordGreaterThanOp FUnordGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanOp FUnordGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FUnordGreaterThanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordGreaterThanOp::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)."); } } FUnordGreaterThanOp FUnordGreaterThanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordGreaterThanOp FUnordGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FUnordGreaterThanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FUnordGreaterThanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FUnordGreaterThanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FUnordGreaterThanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FUnordGreaterThanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FUnordGreaterThanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FUnordGreaterThanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FUnordLessThanEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { FUnordLessThanEqualOpGenericAdaptorBase::FUnordLessThanEqualOpGenericAdaptorBase(FUnordLessThanEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FUnordLessThanEqualOpAdaptor::FUnordLessThanEqualOpAdaptor(FUnordLessThanEqualOp op) : FUnordLessThanEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FUnordLessThanEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FUnordLessThanEqualOp::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 FUnordLessThanEqualOp::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 FUnordLessThanEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FUnordLessThanEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FUnordLessThanEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FUnordLessThanEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FUnordLessThanEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FUnordLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FUnordLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordLessThanEqualOp::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); } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FUnordLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FUnordLessThanEqualOp::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); } FUnordLessThanEqualOp FUnordLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FUnordLessThanEqualOp::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(FUnordLessThanEqualOp::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)."); } } FUnordLessThanEqualOp FUnordLessThanEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FUnordLessThanEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FUnordLessThanEqualOp FUnordLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanEqualOp FUnordLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FUnordLessThanEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordLessThanEqualOp::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)."); } } FUnordLessThanEqualOp FUnordLessThanEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanEqualOp FUnordLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FUnordLessThanEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FUnordLessThanEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FUnordLessThanEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FUnordLessThanEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FUnordLessThanEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FUnordLessThanEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FUnordLessThanEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FUnordLessThanOp definitions //===----------------------------------------------------------------------===// namespace detail { FUnordLessThanOpGenericAdaptorBase::FUnordLessThanOpGenericAdaptorBase(FUnordLessThanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FUnordLessThanOpAdaptor::FUnordLessThanOpAdaptor(FUnordLessThanOp op) : FUnordLessThanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FUnordLessThanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FUnordLessThanOp::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 FUnordLessThanOp::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 FUnordLessThanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FUnordLessThanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FUnordLessThanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FUnordLessThanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FUnordLessThanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FUnordLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FUnordLessThanOp FUnordLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanOp FUnordLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FUnordLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordLessThanOp::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); } FUnordLessThanOp FUnordLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanOp FUnordLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FUnordLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FUnordLessThanOp FUnordLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanOp FUnordLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FUnordLessThanOp::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); } FUnordLessThanOp FUnordLessThanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanOp FUnordLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FUnordLessThanOp::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(FUnordLessThanOp::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)."); } } FUnordLessThanOp FUnordLessThanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanOp FUnordLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FUnordLessThanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FUnordLessThanOp FUnordLessThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanOp FUnordLessThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FUnordLessThanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordLessThanOp::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)."); } } FUnordLessThanOp FUnordLessThanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordLessThanOp FUnordLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FUnordLessThanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FUnordLessThanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FUnordLessThanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FUnordLessThanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FUnordLessThanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FUnordLessThanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FUnordLessThanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FUnordNotEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { FUnordNotEqualOpGenericAdaptorBase::FUnordNotEqualOpGenericAdaptorBase(FUnordNotEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail FUnordNotEqualOpAdaptor::FUnordNotEqualOpAdaptor(FUnordNotEqualOp op) : FUnordNotEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FUnordNotEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult FUnordNotEqualOp::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 FUnordNotEqualOp::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 FUnordNotEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional FUnordNotEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void FUnordNotEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void FUnordNotEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult FUnordNotEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void FUnordNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void FUnordNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordNotEqualOp::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); } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void FUnordNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void FUnordNotEqualOp::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); } FUnordNotEqualOp FUnordNotEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FUnordNotEqualOp::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(FUnordNotEqualOp::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)."); } } FUnordNotEqualOp FUnordNotEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void FUnordNotEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FUnordNotEqualOp FUnordNotEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordNotEqualOp FUnordNotEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void FUnordNotEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(FUnordNotEqualOp::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)."); } } FUnordNotEqualOp FUnordNotEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FUnordNotEqualOp FUnordNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FUnordNotEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult FUnordNotEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FUnordNotEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult FUnordNotEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FUnordNotEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void FUnordNotEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FUnordNotEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FuncOp definitions //===----------------------------------------------------------------------===// namespace detail { FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(FuncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::FunctionType FuncOpGenericAdaptorBase::getFunctionType() { auto attr = getFunctionTypeAttr(); return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); } ::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getArgAttrs() { auto attr = getArgAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getResAttrs() { auto attr = getResAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::llvm::StringRef FuncOpGenericAdaptorBase::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::mlir::spirv::FunctionControl FuncOpGenericAdaptorBase::getFunctionControl() { auto attr = getFunctionControlAttr(); return attr.getValue(); } ::std::optional<::mlir::spirv::LinkageAttributesAttr> FuncOpGenericAdaptorBase::getLinkageAttributes() { auto attr = getLinkageAttributesAttr(); return attr ? ::std::optional<::mlir::spirv::LinkageAttributesAttr>(::llvm::cast<::mlir::spirv::LinkageAttributesAttr>(attr)) : (::std::nullopt); } } // namespace detail FuncOpAdaptor::FuncOpAdaptor(FuncOp op) : FuncOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FuncOpAdaptor::verify(::mlir::Location loc) { auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; auto tblgen_function_control = getProperties().function_control; (void)tblgen_function_control; if (!tblgen_function_control) return emitError(loc, "'spirv.func' op requires attribute 'function_control'"); auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; if (!tblgen_function_type) return emitError(loc, "'spirv.func' op requires attribute 'function_type'"); auto tblgen_linkage_attributes = getProperties().linkage_attributes; (void)tblgen_linkage_attributes; auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitError(loc, "'spirv.func' op requires attribute 'sym_name'"); if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) return emitError(loc, "'spirv.func' op attribute 'function_type' failed to satisfy constraint: type attribute of function type"); if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) return emitError(loc, "'spirv.func' op attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) return emitError(loc, "'spirv.func' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) return emitError(loc, "'spirv.func' op attribute 'sym_name' failed to satisfy constraint: string attribute"); if (tblgen_function_control && !((::llvm::isa<::mlir::spirv::FunctionControlAttr>(tblgen_function_control)))) return emitError(loc, "'spirv.func' op attribute 'function_control' failed to satisfy constraint: valid SPIR-V FunctionControl"); if (tblgen_linkage_attributes && !((::llvm::isa<::mlir::spirv::LinkageAttributesAttr>(tblgen_linkage_attributes)))) return emitError(loc, "'spirv.func' op attribute 'linkage_attributes' failed to satisfy constraint: "); return ::mlir::success(); } ::llvm::LogicalResult FuncOp::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.arg_attrs; auto attr = dict.get("arg_attrs"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.function_control; auto attr = dict.get("function_control"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `function_control` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.function_type; auto attr = dict.get("function_type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `function_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.linkage_attributes; auto attr = dict.get("linkage_attributes"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `linkage_attributes` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.res_attrs; auto attr = dict.get("res_attrs"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto attr = dict.get("sym_name"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute FuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.arg_attrs; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", propStorage)); } { const auto &propStorage = prop.function_control; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("function_control", propStorage)); } { const auto &propStorage = prop.function_type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("function_type", propStorage)); } { const auto &propStorage = prop.linkage_attributes; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("linkage_attributes", propStorage)); } { const auto &propStorage = prop.res_attrs; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("res_attrs", propStorage)); } { const auto &propStorage = prop.sym_name; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("sym_name", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code FuncOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), llvm::hash_value(prop.function_control.getAsOpaquePointer()), llvm::hash_value(prop.function_type.getAsOpaquePointer()), llvm::hash_value(prop.linkage_attributes.getAsOpaquePointer()), llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), llvm::hash_value(prop.sym_name.getAsOpaquePointer())); } std::optional FuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "arg_attrs") return prop.arg_attrs; if (name == "function_control") return prop.function_control; if (name == "function_type") return prop.function_type; if (name == "linkage_attributes") return prop.linkage_attributes; if (name == "res_attrs") return prop.res_attrs; if (name == "sym_name") return prop.sym_name; return std::nullopt; } void FuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "arg_attrs") { prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); return; } if (name == "function_control") { prop.function_control = ::llvm::dyn_cast_or_null>(value); return; } if (name == "function_type") { prop.function_type = ::llvm::dyn_cast_or_null>(value); return; } if (name == "linkage_attributes") { prop.linkage_attributes = ::llvm::dyn_cast_or_null>(value); return; } if (name == "res_attrs") { prop.res_attrs = ::llvm::dyn_cast_or_null>(value); return; } if (name == "sym_name") { prop.sym_name = ::llvm::dyn_cast_or_null>(value); return; } } void FuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); if (prop.function_control) attrs.append("function_control", prop.function_control); if (prop.function_type) attrs.append("function_type", prop.function_type); if (prop.linkage_attributes) attrs.append("linkage_attributes", prop.linkage_attributes); if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); if (prop.sym_name) attrs.append("sym_name", prop.sym_name); } ::llvm::LogicalResult FuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(attr, "arg_attrs", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getFunctionControlAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps17(attr, "function_control", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps15(attr, "function_type", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLinkageAttributesAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps18(attr, "linkage_attributes", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(attr, "res_attrs", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(attr, "sym_name", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult FuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.function_control))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.function_type))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.linkage_attributes))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.sym_name))) return ::mlir::failure(); return ::mlir::success(); } void FuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.arg_attrs); writer.writeAttribute(prop.function_control); writer.writeAttribute(prop.function_type); writer.writeOptionalAttribute(prop.linkage_attributes); writer.writeOptionalAttribute(prop.res_attrs); writer.writeAttribute(prop.sym_name); } ::mlir::FunctionType FuncOp::getFunctionType() { auto attr = getFunctionTypeAttr(); return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); } ::std::optional< ::mlir::ArrayAttr > FuncOp::getArgAttrs() { auto attr = getArgAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::std::optional< ::mlir::ArrayAttr > FuncOp::getResAttrs() { auto attr = getResAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::llvm::StringRef FuncOp::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::mlir::spirv::FunctionControl FuncOp::getFunctionControl() { auto attr = getFunctionControlAttr(); return attr.getValue(); } ::std::optional<::mlir::spirv::LinkageAttributesAttr> FuncOp::getLinkageAttributes() { auto attr = getLinkageAttributesAttr(); return attr ? ::std::optional<::mlir::spirv::LinkageAttributesAttr>(::llvm::cast<::mlir::spirv::LinkageAttributesAttr>(attr)) : (::std::nullopt); } void FuncOp::setFunctionType(::mlir::FunctionType attrValue) { getProperties().function_type = ::mlir::TypeAttr::get(attrValue); } void FuncOp::setSymName(::llvm::StringRef attrValue) { getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue); } void FuncOp::setFunctionControl(::mlir::spirv::FunctionControl attrValue) { getProperties().function_control = ::mlir::spirv::FunctionControlAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef name, FunctionType type, spirv::FunctionControl control, ArrayRef attrs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(name), std::forward(type), std::forward(control), std::forward(attrs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, StringRef name, FunctionType type, spirv::FunctionControl control, ArrayRef attrs) { return create(builder, builder.getLoc(), std::forward(name), std::forward(type), std::forward(control), std::forward(attrs)); } void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_name, ::mlir::spirv::FunctionControlAttr function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { odsState.getOrAddProperties().function_type = function_type; if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } odsState.getOrAddProperties().sym_name = sym_name; odsState.getOrAddProperties().function_control = function_control; if (linkage_attributes) { odsState.getOrAddProperties().linkage_attributes = linkage_attributes; } (void)odsState.addRegion(); } FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_name, ::mlir::spirv::FunctionControlAttr function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(sym_name), std::forward(function_control), std::forward(linkage_attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_name, ::mlir::spirv::FunctionControlAttr function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { return create(builder, builder.getLoc(), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(sym_name), std::forward(function_control), std::forward(linkage_attributes)); } void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_name, ::mlir::spirv::FunctionControlAttr function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { odsState.getOrAddProperties().function_type = function_type; if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } odsState.getOrAddProperties().sym_name = sym_name; odsState.getOrAddProperties().function_control = function_control; if (linkage_attributes) { odsState.getOrAddProperties().linkage_attributes = linkage_attributes; } (void)odsState.addRegion(); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_name, ::mlir::spirv::FunctionControlAttr function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(sym_name), std::forward(function_control), std::forward(linkage_attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_name, ::mlir::spirv::FunctionControlAttr function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(sym_name), std::forward(function_control), std::forward(linkage_attributes)); } void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::llvm::StringRef sym_name, ::mlir::spirv::FunctionControl function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); odsState.getOrAddProperties().function_control = ::mlir::spirv::FunctionControlAttr::get(odsBuilder.getContext(), function_control); if (linkage_attributes) { odsState.getOrAddProperties().linkage_attributes = linkage_attributes; } (void)odsState.addRegion(); } FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::llvm::StringRef sym_name, ::mlir::spirv::FunctionControl function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(sym_name), std::forward(function_control), std::forward(linkage_attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::llvm::StringRef sym_name, ::mlir::spirv::FunctionControl function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { return create(builder, builder.getLoc(), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(sym_name), std::forward(function_control), std::forward(linkage_attributes)); } void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::llvm::StringRef sym_name, ::mlir::spirv::FunctionControl function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); odsState.getOrAddProperties().function_control = ::mlir::spirv::FunctionControlAttr::get(odsBuilder.getContext(), function_control); if (linkage_attributes) { odsState.getOrAddProperties().linkage_attributes = linkage_attributes; } (void)odsState.addRegion(); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::llvm::StringRef sym_name, ::mlir::spirv::FunctionControl function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(sym_name), std::forward(function_control), std::forward(linkage_attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, ::llvm::StringRef sym_name, ::mlir::spirv::FunctionControl function_control, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(sym_name), std::forward(function_control), std::forward(linkage_attributes)); } void FuncOp::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); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } FuncOp FuncOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FuncOp::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)); odsState.addAttributes(discardableAttributes); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } FuncOp FuncOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FuncOp FuncOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FuncOp::verifyInvariantsImpl() { auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; auto tblgen_function_control = getProperties().function_control; (void)tblgen_function_control; if (!tblgen_function_control) return emitOpError("requires attribute 'function_control'"); auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); auto tblgen_linkage_attributes = getProperties().linkage_attributes; (void)tblgen_linkage_attributes; auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps15(*this, tblgen_function_type, "function_type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(*this, tblgen_arg_attrs, "arg_attrs"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(*this, tblgen_res_attrs, "res_attrs"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(*this, tblgen_sym_name, "sym_name"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps17(*this, tblgen_function_control, "function_control"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps18(*this, tblgen_linkage_attributes, "linkage_attributes"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); { unsigned index = 0; (void)index; for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) if (::mlir::failed(__mlir_ods_local_region_constraint_SPIRVOps1(*this, region, "body", index++))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult FuncOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult FuncOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.function_type; auto function_typeAttrName = ::mlir::StringAttr::get(ctx, "function_type"); auto attr = dict.get(function_typeAttrName); usedKeys.insert(function_typeAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for function_type in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `function_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.arg_attrs; auto arg_attrsAttrName = ::mlir::StringAttr::get(ctx, "arg_attrs"); auto attr = dict.get(arg_attrsAttrName); usedKeys.insert(arg_attrsAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.res_attrs; auto res_attrsAttrName = ::mlir::StringAttr::get(ctx, "res_attrs"); auto attr = dict.get(res_attrsAttrName); usedKeys.insert(res_attrsAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for res_attrs in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name"); auto attr = dict.get(sym_nameAttrName); usedKeys.insert(sym_nameAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for sym_name in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.function_control; auto function_controlAttrName = ::mlir::StringAttr::get(ctx, "function_control"); auto attr = dict.get(function_controlAttrName); usedKeys.insert(function_controlAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for function_control in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `function_control` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.linkage_attributes; auto linkage_attributesAttrName = ::mlir::StringAttr::get(ctx, "linkage_attributes"); auto attr = dict.get(linkage_attributesAttrName); usedKeys.insert(linkage_attributesAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for linkage_attributes in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `linkage_attributes` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FuncOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::FuncOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::FunctionCallOp definitions //===----------------------------------------------------------------------===// namespace detail { FunctionCallOpGenericAdaptorBase::FunctionCallOpGenericAdaptorBase(FunctionCallOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair FunctionCallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {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 - 0) / 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}; } ::llvm::StringRef FunctionCallOpGenericAdaptorBase::getCallee() { auto attr = getCalleeAttr(); return attr.getValue(); } ::std::optional< ::mlir::ArrayAttr > FunctionCallOpGenericAdaptorBase::getArgAttrs() { auto attr = getArgAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::std::optional< ::mlir::ArrayAttr > FunctionCallOpGenericAdaptorBase::getResAttrs() { auto attr = getResAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } } // namespace detail FunctionCallOpAdaptor::FunctionCallOpAdaptor(FunctionCallOp op) : FunctionCallOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult FunctionCallOpAdaptor::verify(::mlir::Location loc) { auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; auto tblgen_callee = getProperties().callee; (void)tblgen_callee; if (!tblgen_callee) return emitError(loc, "'spirv.FunctionCall' op requires attribute 'callee'"); auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee)))) return emitError(loc, "'spirv.FunctionCall' op attribute 'callee' failed to satisfy constraint: flat symbol reference attribute"); if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) return emitError(loc, "'spirv.FunctionCall' op attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) return emitError(loc, "'spirv.FunctionCall' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); return ::mlir::success(); } std::pair FunctionCallOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {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() - 0) / 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 FunctionCallOp::getArgumentsMutable() { auto range = getODSOperandIndexAndLength(0); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } std::pair FunctionCallOp::getODSResultIndexAndLength(unsigned index) { bool isVariadic[] = {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()->getNumResults() - 0) / 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}; } ::llvm::LogicalResult FunctionCallOp::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.arg_attrs; auto attr = dict.get("arg_attrs"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.callee; auto attr = dict.get("callee"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `callee` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.res_attrs; auto attr = dict.get("res_attrs"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute FunctionCallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.arg_attrs; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", propStorage)); } { const auto &propStorage = prop.callee; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("callee", propStorage)); } { const auto &propStorage = prop.res_attrs; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("res_attrs", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code FunctionCallOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), llvm::hash_value(prop.callee.getAsOpaquePointer()), llvm::hash_value(prop.res_attrs.getAsOpaquePointer())); } std::optional FunctionCallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "arg_attrs") return prop.arg_attrs; if (name == "callee") return prop.callee; if (name == "res_attrs") return prop.res_attrs; return std::nullopt; } void FunctionCallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "arg_attrs") { prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); return; } if (name == "callee") { prop.callee = ::llvm::dyn_cast_or_null>(value); return; } if (name == "res_attrs") { prop.res_attrs = ::llvm::dyn_cast_or_null>(value); return; } } void FunctionCallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); if (prop.callee) attrs.append("callee", prop.callee); if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); } ::llvm::LogicalResult FunctionCallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(attr, "arg_attrs", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(attr, "callee", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(attr, "res_attrs", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult FunctionCallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.callee))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) return ::mlir::failure(); return ::mlir::success(); } void FunctionCallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.arg_attrs); writer.writeAttribute(prop.callee); writer.writeOptionalAttribute(prop.res_attrs); } ::llvm::StringRef FunctionCallOp::getCallee() { auto attr = getCalleeAttr(); return attr.getValue(); } ::std::optional< ::mlir::ArrayAttr > FunctionCallOp::getArgAttrs() { auto attr = getArgAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::std::optional< ::mlir::ArrayAttr > FunctionCallOp::getResAttrs() { auto attr = getResAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } void FunctionCallOp::setCallee(::llvm::StringRef attrValue) { getProperties().callee = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void FunctionCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type returnType, FlatSymbolRefAttr callee, ValueRange arguments) { build(odsBuilder, odsState, returnType, callee, arguments, /*arg_attrs=*/nullptr, /*res_attrs=*/nullptr); } FunctionCallOp FunctionCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type returnType, FlatSymbolRefAttr callee, ValueRange arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(returnType), std::forward(callee), std::forward(arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FunctionCallOp FunctionCallOp::create(::mlir::ImplicitLocOpBuilder &builder, Type returnType, FlatSymbolRefAttr callee, ValueRange arguments) { return create(builder, builder.getLoc(), std::forward(returnType), std::forward(callee), std::forward(arguments)); } void FunctionCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type return_value, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { odsState.addOperands(arguments); odsState.getOrAddProperties().callee = callee; if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } if (return_value) odsState.addTypes(return_value); } FunctionCallOp FunctionCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type return_value, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(return_value), std::forward(callee), std::forward(arguments), std::forward(arg_attrs), std::forward(res_attrs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FunctionCallOp FunctionCallOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type return_value, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { return create(builder, builder.getLoc(), std::forward(return_value), std::forward(callee), std::forward(arguments), std::forward(arg_attrs), std::forward(res_attrs)); } void FunctionCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { odsState.addOperands(arguments); odsState.getOrAddProperties().callee = callee; if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } odsState.addTypes(resultTypes); } FunctionCallOp FunctionCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(callee), std::forward(arguments), std::forward(arg_attrs), std::forward(res_attrs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FunctionCallOp FunctionCallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(callee), std::forward(arguments), std::forward(arg_attrs), std::forward(res_attrs)); } void FunctionCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type return_value, ::llvm::StringRef callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { odsState.addOperands(arguments); odsState.getOrAddProperties().callee = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), callee); if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } if (return_value) odsState.addTypes(return_value); } FunctionCallOp FunctionCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type return_value, ::llvm::StringRef callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(return_value), std::forward(callee), std::forward(arguments), std::forward(arg_attrs), std::forward(res_attrs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FunctionCallOp FunctionCallOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type return_value, ::llvm::StringRef callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { return create(builder, builder.getLoc(), std::forward(return_value), std::forward(callee), std::forward(arguments), std::forward(arg_attrs), std::forward(res_attrs)); } void FunctionCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { odsState.addOperands(arguments); odsState.getOrAddProperties().callee = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), callee); if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } odsState.addTypes(resultTypes); } FunctionCallOp FunctionCallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(callee), std::forward(arguments), std::forward(arg_attrs), std::forward(res_attrs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FunctionCallOp FunctionCallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arguments, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(callee), std::forward(arguments), std::forward(arg_attrs), std::forward(res_attrs)); } void FunctionCallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { odsState.addOperands(operands); odsState.addAttributes(attributes); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } FunctionCallOp FunctionCallOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FunctionCallOp FunctionCallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void FunctionCallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { odsState.addOperands(operands); odsState.useProperties(const_cast(properties)); odsState.addAttributes(discardableAttributes); odsState.addTypes(resultTypes); } FunctionCallOp FunctionCallOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } FunctionCallOp FunctionCallOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult FunctionCallOp::verifyInvariantsImpl() { auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; auto tblgen_callee = getProperties().callee; (void)tblgen_callee; if (!tblgen_callee) return emitOpError("requires attribute 'callee'"); auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(*this, tblgen_callee, "callee"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(*this, tblgen_arg_attrs, "arg_attrs"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(*this, tblgen_res_attrs, "res_attrs"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); if (valueGroup0.size() > 1) { return emitOpError("result group starting at #") << index << " requires 0 or 1 element, but found " << valueGroup0.size(); } for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult FunctionCallOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult FunctionCallOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::FlatSymbolRefAttr calleeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argumentsOperands; ::llvm::SMLoc argumentsOperandsLoc; (void)argumentsOperandsLoc; ::llvm::ArrayRef<::mlir::Type> argumentsTypes; ::llvm::ArrayRef<::mlir::Type> allResultTypes; if (parser.parseCustomAttributeWithFallback(calleeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { return ::mlir::failure(); } if (calleeAttr) result.getOrAddProperties().callee = calleeAttr; if (parser.parseLParen()) return ::mlir::failure(); argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(argumentsOperands)) return ::mlir::failure(); 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::FunctionType arguments__allResult_functionType; if (parser.parseType(arguments__allResult_functionType)) return ::mlir::failure(); argumentsTypes = arguments__allResult_functionType.getInputs(); allResultTypes = arguments__allResult_functionType.getResults(); result.addTypes(allResultTypes); if (parser.resolveOperands(argumentsOperands, argumentsTypes, argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void FunctionCallOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getCalleeAttr()); _odsPrinter << "("; _odsPrinter << getArguments(); _odsPrinter << ")"; ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("callee"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter.printFunctionalType(getArguments().getTypes(), getOperation()->getResultTypes()); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::FunctionCallOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::FunctionCallOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLAcosOp definitions //===----------------------------------------------------------------------===// namespace detail { GLAcosOpGenericAdaptorBase::GLAcosOpGenericAdaptorBase(GLAcosOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLAcosOpAdaptor::GLAcosOpAdaptor(GLAcosOp op) : GLAcosOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLAcosOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLAcosOp::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 GLAcosOp::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 GLAcosOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLAcosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLAcosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLAcosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLAcosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLAcosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLAcosOp GLAcosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcosOp GLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLAcosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAcosOp::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); } GLAcosOp GLAcosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcosOp GLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLAcosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLAcosOp GLAcosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcosOp GLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLAcosOp::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); } GLAcosOp GLAcosOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcosOp GLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLAcosOp::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(GLAcosOp::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)."); } } GLAcosOp GLAcosOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcosOp GLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLAcosOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLAcosOp GLAcosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcosOp GLAcosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLAcosOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAcosOp::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)."); } } GLAcosOp GLAcosOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcosOp GLAcosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLAcosOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLAcosOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLAcosOp::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 GLAcosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLAcosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLAcosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLAcosOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLAcoshOp definitions //===----------------------------------------------------------------------===// namespace detail { GLAcoshOpGenericAdaptorBase::GLAcoshOpGenericAdaptorBase(GLAcoshOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLAcoshOpAdaptor::GLAcoshOpAdaptor(GLAcoshOp op) : GLAcoshOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLAcoshOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLAcoshOp::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 GLAcoshOp::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 GLAcoshOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLAcoshOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLAcoshOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLAcoshOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLAcoshOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLAcoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLAcoshOp GLAcoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcoshOp GLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLAcoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAcoshOp::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); } GLAcoshOp GLAcoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcoshOp GLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLAcoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLAcoshOp GLAcoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcoshOp GLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLAcoshOp::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); } GLAcoshOp GLAcoshOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcoshOp GLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLAcoshOp::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(GLAcoshOp::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)."); } } GLAcoshOp GLAcoshOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcoshOp GLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLAcoshOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLAcoshOp GLAcoshOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcoshOp GLAcoshOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLAcoshOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAcoshOp::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)."); } } GLAcoshOp GLAcoshOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAcoshOp GLAcoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLAcoshOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLAcoshOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLAcoshOp::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 GLAcoshOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLAcoshOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLAcoshOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLAcoshOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLAsinOp definitions //===----------------------------------------------------------------------===// namespace detail { GLAsinOpGenericAdaptorBase::GLAsinOpGenericAdaptorBase(GLAsinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLAsinOpAdaptor::GLAsinOpAdaptor(GLAsinOp op) : GLAsinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLAsinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLAsinOp::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 GLAsinOp::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 GLAsinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLAsinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLAsinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLAsinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLAsinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLAsinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLAsinOp GLAsinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinOp GLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLAsinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAsinOp::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); } GLAsinOp GLAsinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinOp GLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLAsinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLAsinOp GLAsinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinOp GLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLAsinOp::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); } GLAsinOp GLAsinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinOp GLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLAsinOp::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(GLAsinOp::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)."); } } GLAsinOp GLAsinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinOp GLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLAsinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLAsinOp GLAsinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinOp GLAsinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLAsinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAsinOp::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)."); } } GLAsinOp GLAsinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinOp GLAsinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLAsinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLAsinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLAsinOp::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 GLAsinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLAsinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLAsinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLAsinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLAsinhOp definitions //===----------------------------------------------------------------------===// namespace detail { GLAsinhOpGenericAdaptorBase::GLAsinhOpGenericAdaptorBase(GLAsinhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLAsinhOpAdaptor::GLAsinhOpAdaptor(GLAsinhOp op) : GLAsinhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLAsinhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLAsinhOp::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 GLAsinhOp::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 GLAsinhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLAsinhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLAsinhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLAsinhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLAsinhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLAsinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLAsinhOp GLAsinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinhOp GLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLAsinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAsinhOp::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); } GLAsinhOp GLAsinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinhOp GLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLAsinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLAsinhOp GLAsinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinhOp GLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLAsinhOp::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); } GLAsinhOp GLAsinhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinhOp GLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLAsinhOp::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(GLAsinhOp::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)."); } } GLAsinhOp GLAsinhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinhOp GLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLAsinhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLAsinhOp GLAsinhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinhOp GLAsinhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLAsinhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAsinhOp::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)."); } } GLAsinhOp GLAsinhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAsinhOp GLAsinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLAsinhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLAsinhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLAsinhOp::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 GLAsinhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLAsinhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLAsinhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLAsinhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLAtan2Op definitions //===----------------------------------------------------------------------===// namespace detail { GLAtan2OpGenericAdaptorBase::GLAtan2OpGenericAdaptorBase(GLAtan2Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLAtan2OpAdaptor::GLAtan2OpAdaptor(GLAtan2Op op) : GLAtan2OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLAtan2OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLAtan2Op::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 GLAtan2Op::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 GLAtan2Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLAtan2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLAtan2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLAtan2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLAtan2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLAtan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLAtan2Op GLAtan2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtan2Op GLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLAtan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAtan2Op::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); } GLAtan2Op GLAtan2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtan2Op GLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLAtan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLAtan2Op GLAtan2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtan2Op GLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLAtan2Op::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); } GLAtan2Op GLAtan2Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtan2Op GLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLAtan2Op::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(GLAtan2Op::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)."); } } GLAtan2Op GLAtan2Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtan2Op GLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLAtan2Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLAtan2Op GLAtan2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtan2Op GLAtan2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLAtan2Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAtan2Op::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)."); } } GLAtan2Op GLAtan2Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtan2Op GLAtan2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLAtan2Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLAtan2Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLAtan2Op::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 GLAtan2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLAtan2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLAtan2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLAtan2Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLAtanOp definitions //===----------------------------------------------------------------------===// namespace detail { GLAtanOpGenericAdaptorBase::GLAtanOpGenericAdaptorBase(GLAtanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLAtanOpAdaptor::GLAtanOpAdaptor(GLAtanOp op) : GLAtanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLAtanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLAtanOp::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 GLAtanOp::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 GLAtanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLAtanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLAtanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLAtanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLAtanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLAtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLAtanOp GLAtanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanOp GLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLAtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAtanOp::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); } GLAtanOp GLAtanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanOp GLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLAtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLAtanOp GLAtanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanOp GLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLAtanOp::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); } GLAtanOp GLAtanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanOp GLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLAtanOp::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(GLAtanOp::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)."); } } GLAtanOp GLAtanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanOp GLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLAtanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLAtanOp GLAtanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanOp GLAtanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLAtanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAtanOp::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)."); } } GLAtanOp GLAtanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanOp GLAtanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLAtanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLAtanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLAtanOp::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 GLAtanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLAtanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLAtanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLAtanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLAtanhOp definitions //===----------------------------------------------------------------------===// namespace detail { GLAtanhOpGenericAdaptorBase::GLAtanhOpGenericAdaptorBase(GLAtanhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLAtanhOpAdaptor::GLAtanhOpAdaptor(GLAtanhOp op) : GLAtanhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLAtanhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLAtanhOp::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 GLAtanhOp::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 GLAtanhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLAtanhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLAtanhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLAtanhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLAtanhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLAtanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLAtanhOp GLAtanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanhOp GLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLAtanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAtanhOp::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); } GLAtanhOp GLAtanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanhOp GLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLAtanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLAtanhOp GLAtanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanhOp GLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLAtanhOp::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); } GLAtanhOp GLAtanhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanhOp GLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLAtanhOp::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(GLAtanhOp::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)."); } } GLAtanhOp GLAtanhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanhOp GLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLAtanhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLAtanhOp GLAtanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanhOp GLAtanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLAtanhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLAtanhOp::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)."); } } GLAtanhOp GLAtanhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLAtanhOp GLAtanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLAtanhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLAtanhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLAtanhOp::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 GLAtanhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLAtanhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLAtanhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLAtanhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLCeilOp definitions //===----------------------------------------------------------------------===// namespace detail { GLCeilOpGenericAdaptorBase::GLCeilOpGenericAdaptorBase(GLCeilOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLCeilOpAdaptor::GLCeilOpAdaptor(GLCeilOp op) : GLCeilOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLCeilOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLCeilOp::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 GLCeilOp::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 GLCeilOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLCeilOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLCeilOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLCeilOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLCeilOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLCeilOp GLCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCeilOp GLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLCeilOp::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); } GLCeilOp GLCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCeilOp GLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLCeilOp GLCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCeilOp GLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLCeilOp::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); } GLCeilOp GLCeilOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCeilOp GLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLCeilOp::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(GLCeilOp::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)."); } } GLCeilOp GLCeilOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCeilOp GLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLCeilOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLCeilOp GLCeilOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCeilOp GLCeilOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLCeilOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLCeilOp::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)."); } } GLCeilOp GLCeilOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCeilOp GLCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLCeilOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLCeilOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLCeilOp::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 GLCeilOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLCeilOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLCeilOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLCeilOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLCosOp definitions //===----------------------------------------------------------------------===// namespace detail { GLCosOpGenericAdaptorBase::GLCosOpGenericAdaptorBase(GLCosOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLCosOpAdaptor::GLCosOpAdaptor(GLCosOp op) : GLCosOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLCosOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLCosOp::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 GLCosOp::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 GLCosOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLCosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLCosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLCosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLCosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLCosOp GLCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCosOp GLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLCosOp::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); } GLCosOp GLCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCosOp GLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLCosOp GLCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCosOp GLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLCosOp::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); } GLCosOp GLCosOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCosOp GLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLCosOp::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(GLCosOp::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)."); } } GLCosOp GLCosOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCosOp GLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLCosOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLCosOp GLCosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCosOp GLCosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLCosOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLCosOp::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)."); } } GLCosOp GLCosOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCosOp GLCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLCosOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLCosOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLCosOp::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 GLCosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLCosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLCosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLCosOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLCoshOp definitions //===----------------------------------------------------------------------===// namespace detail { GLCoshOpGenericAdaptorBase::GLCoshOpGenericAdaptorBase(GLCoshOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLCoshOpAdaptor::GLCoshOpAdaptor(GLCoshOp op) : GLCoshOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLCoshOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLCoshOp::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 GLCoshOp::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 GLCoshOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLCoshOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLCoshOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLCoshOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLCoshOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLCoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLCoshOp GLCoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCoshOp GLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLCoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLCoshOp::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); } GLCoshOp GLCoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCoshOp GLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLCoshOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLCoshOp GLCoshOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCoshOp GLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLCoshOp::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); } GLCoshOp GLCoshOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCoshOp GLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLCoshOp::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(GLCoshOp::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)."); } } GLCoshOp GLCoshOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCoshOp GLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLCoshOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLCoshOp GLCoshOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCoshOp GLCoshOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLCoshOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLCoshOp::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)."); } } GLCoshOp GLCoshOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCoshOp GLCoshOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLCoshOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLCoshOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLCoshOp::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 GLCoshOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLCoshOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLCoshOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLCoshOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLCrossOp definitions //===----------------------------------------------------------------------===// namespace detail { GLCrossOpGenericAdaptorBase::GLCrossOpGenericAdaptorBase(GLCrossOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLCrossOpAdaptor::GLCrossOpAdaptor(GLCrossOp op) : GLCrossOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLCrossOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLCrossOp::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 GLCrossOp::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 GLCrossOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLCrossOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLCrossOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLCrossOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLCrossOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLCrossOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLCrossOp GLCrossOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCrossOp GLCrossOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLCrossOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLCrossOp::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); } GLCrossOp GLCrossOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCrossOp GLCrossOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLCrossOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLCrossOp GLCrossOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCrossOp GLCrossOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLCrossOp::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); } GLCrossOp GLCrossOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCrossOp GLCrossOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLCrossOp::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(GLCrossOp::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)."); } } GLCrossOp GLCrossOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCrossOp GLCrossOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLCrossOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLCrossOp GLCrossOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCrossOp GLCrossOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLCrossOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLCrossOp::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)."); } } GLCrossOp GLCrossOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLCrossOp GLCrossOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLCrossOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLCrossOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLCrossOp::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 GLCrossOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLCrossOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLCrossOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLCrossOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLDegreesOp definitions //===----------------------------------------------------------------------===// namespace detail { GLDegreesOpGenericAdaptorBase::GLDegreesOpGenericAdaptorBase(GLDegreesOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLDegreesOpAdaptor::GLDegreesOpAdaptor(GLDegreesOp op) : GLDegreesOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLDegreesOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLDegreesOp::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 GLDegreesOp::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 GLDegreesOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLDegreesOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLDegreesOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLDegreesOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLDegreesOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLDegreesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLDegreesOp GLDegreesOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDegreesOp GLDegreesOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLDegreesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLDegreesOp::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); } GLDegreesOp GLDegreesOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDegreesOp GLDegreesOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLDegreesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLDegreesOp GLDegreesOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDegreesOp GLDegreesOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLDegreesOp::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); } GLDegreesOp GLDegreesOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDegreesOp GLDegreesOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLDegreesOp::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(GLDegreesOp::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)."); } } GLDegreesOp GLDegreesOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDegreesOp GLDegreesOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLDegreesOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLDegreesOp GLDegreesOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDegreesOp GLDegreesOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLDegreesOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLDegreesOp::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)."); } } GLDegreesOp GLDegreesOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDegreesOp GLDegreesOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLDegreesOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLDegreesOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLDegreesOp::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 GLDegreesOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLDegreesOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLDegreesOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLDegreesOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLDistanceOp definitions //===----------------------------------------------------------------------===// namespace detail { GLDistanceOpGenericAdaptorBase::GLDistanceOpGenericAdaptorBase(GLDistanceOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLDistanceOpAdaptor::GLDistanceOpAdaptor(GLDistanceOp op) : GLDistanceOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLDistanceOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLDistanceOp::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 GLDistanceOp::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 GLDistanceOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLDistanceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLDistanceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLDistanceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLDistanceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLDistanceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value p0, ::mlir::Value p1) { odsState.addOperands(p0); odsState.addOperands(p1); odsState.addTypes(result); } GLDistanceOp GLDistanceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value p0, ::mlir::Value p1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(p0), std::forward(p1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDistanceOp GLDistanceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value p0, ::mlir::Value p1) { return create(builder, builder.getLoc(), std::forward(result), std::forward(p0), std::forward(p1)); } void GLDistanceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value p0, ::mlir::Value p1) { odsState.addOperands(p0); odsState.addOperands(p1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLDistanceOp::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); } GLDistanceOp GLDistanceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value p0, ::mlir::Value p1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(p0), std::forward(p1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDistanceOp GLDistanceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value p0, ::mlir::Value p1) { return create(builder, builder.getLoc(), std::forward(p0), std::forward(p1)); } void GLDistanceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value p0, ::mlir::Value p1) { odsState.addOperands(p0); odsState.addOperands(p1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLDistanceOp GLDistanceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value p0, ::mlir::Value p1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(p0), std::forward(p1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDistanceOp GLDistanceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value p0, ::mlir::Value p1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(p0), std::forward(p1)); } void GLDistanceOp::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); } GLDistanceOp GLDistanceOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDistanceOp GLDistanceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLDistanceOp::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(GLDistanceOp::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)."); } } GLDistanceOp GLDistanceOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDistanceOp GLDistanceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLDistanceOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLDistanceOp GLDistanceOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDistanceOp GLDistanceOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLDistanceOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLDistanceOp::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)."); } } GLDistanceOp GLDistanceOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLDistanceOp GLDistanceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLDistanceOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps17(*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->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that all of {p0, p1} have same type"); if (!((std::equal_to<>()(::mlir::getElementTypeOrSelf((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that result type must match operand element type"); return ::mlir::success(); } ::llvm::LogicalResult GLDistanceOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLDistanceOp::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 = ::mlir::getElementTypeOrSelf(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult GLDistanceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type p0RawType{}; ::llvm::ArrayRef<::mlir::Type> p0Types(&p0RawType, 1); ::mlir::Type p1RawType{}; ::llvm::ArrayRef<::mlir::Type> p1Types(&p1RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); p0RawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); p1RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(p0Types), ::llvm::ArrayRef<::mlir::Type>(p1Types)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLDistanceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getP0().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getP1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 GLDistanceOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLDistanceOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLExp2Op definitions //===----------------------------------------------------------------------===// namespace detail { GLExp2OpGenericAdaptorBase::GLExp2OpGenericAdaptorBase(GLExp2Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLExp2OpAdaptor::GLExp2OpAdaptor(GLExp2Op op) : GLExp2OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLExp2OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLExp2Op::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 GLExp2Op::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 GLExp2Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLExp2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLExp2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLExp2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLExp2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLExp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLExp2Op GLExp2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExp2Op GLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLExp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLExp2Op::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); } GLExp2Op GLExp2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExp2Op GLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLExp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLExp2Op GLExp2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExp2Op GLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLExp2Op::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); } GLExp2Op GLExp2Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExp2Op GLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLExp2Op::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(GLExp2Op::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)."); } } GLExp2Op GLExp2Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExp2Op GLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLExp2Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLExp2Op GLExp2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExp2Op GLExp2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLExp2Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLExp2Op::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)."); } } GLExp2Op GLExp2Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExp2Op GLExp2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLExp2Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLExp2Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLExp2Op::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 GLExp2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLExp2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLExp2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLExp2Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLExpOp definitions //===----------------------------------------------------------------------===// namespace detail { GLExpOpGenericAdaptorBase::GLExpOpGenericAdaptorBase(GLExpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLExpOpAdaptor::GLExpOpAdaptor(GLExpOp op) : GLExpOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLExpOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLExpOp::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 GLExpOp::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 GLExpOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLExpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLExpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLExpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLExpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLExpOp GLExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExpOp GLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLExpOp::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); } GLExpOp GLExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExpOp GLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLExpOp GLExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExpOp GLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLExpOp::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); } GLExpOp GLExpOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExpOp GLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLExpOp::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(GLExpOp::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)."); } } GLExpOp GLExpOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExpOp GLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLExpOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLExpOp GLExpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExpOp GLExpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLExpOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLExpOp::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)."); } } GLExpOp GLExpOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLExpOp GLExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLExpOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLExpOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLExpOp::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 GLExpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLExpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLExpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLExpOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFAbsOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFAbsOpGenericAdaptorBase::GLFAbsOpGenericAdaptorBase(GLFAbsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFAbsOpAdaptor::GLFAbsOpAdaptor(GLFAbsOp op) : GLFAbsOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFAbsOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFAbsOp::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 GLFAbsOp::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 GLFAbsOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFAbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFAbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFAbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFAbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLFAbsOp GLFAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFAbsOp GLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLFAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFAbsOp::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); } GLFAbsOp GLFAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFAbsOp GLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLFAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFAbsOp GLFAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFAbsOp GLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLFAbsOp::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); } GLFAbsOp GLFAbsOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFAbsOp GLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFAbsOp::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(GLFAbsOp::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)."); } } GLFAbsOp GLFAbsOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFAbsOp GLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFAbsOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFAbsOp GLFAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFAbsOp GLFAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFAbsOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFAbsOp::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)."); } } GLFAbsOp GLFAbsOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFAbsOp GLFAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFAbsOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFAbsOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFAbsOp::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 GLFAbsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFAbsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLFAbsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFAbsOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFClampOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFClampOpGenericAdaptorBase::GLFClampOpGenericAdaptorBase(GLFClampOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFClampOpAdaptor::GLFClampOpAdaptor(GLFClampOp op) : GLFClampOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFClampOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFClampOp::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 GLFClampOp::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 GLFClampOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFClampOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFClampOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFClampOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFClampOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); odsState.addTypes(result); } GLFClampOp GLFClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFClampOp GLFClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(y), std::forward(z)); } void GLFClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFClampOp GLFClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFClampOp GLFClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); } void GLFClampOp::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); } GLFClampOp GLFClampOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFClampOp GLFClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFClampOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFClampOp GLFClampOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFClampOp GLFClampOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFClampOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFClampOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFClampOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void GLFClampOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFClampOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFMaxOpGenericAdaptorBase::GLFMaxOpGenericAdaptorBase(GLFMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFMaxOpAdaptor::GLFMaxOpAdaptor(GLFMaxOp op) : GLFMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFMaxOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFMaxOp::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 GLFMaxOp::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 GLFMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLFMaxOp GLFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMaxOp GLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFMaxOp::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); } GLFMaxOp GLFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMaxOp GLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFMaxOp GLFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMaxOp GLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLFMaxOp::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); } GLFMaxOp GLFMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMaxOp GLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFMaxOp::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(GLFMaxOp::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)."); } } GLFMaxOp GLFMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMaxOp GLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFMaxOp GLFMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMaxOp GLFMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFMaxOp::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)."); } } GLFMaxOp GLFMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMaxOp GLFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFMaxOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFMaxOp::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 GLFMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLFMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFMaxOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFMinOpGenericAdaptorBase::GLFMinOpGenericAdaptorBase(GLFMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFMinOpAdaptor::GLFMinOpAdaptor(GLFMinOp op) : GLFMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFMinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFMinOp::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 GLFMinOp::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 GLFMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLFMinOp GLFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMinOp GLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFMinOp::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); } GLFMinOp GLFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMinOp GLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFMinOp GLFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMinOp GLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLFMinOp::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); } GLFMinOp GLFMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMinOp GLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFMinOp::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(GLFMinOp::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)."); } } GLFMinOp GLFMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMinOp GLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFMinOp GLFMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMinOp GLFMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFMinOp::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)."); } } GLFMinOp GLFMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMinOp GLFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFMinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFMinOp::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 GLFMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLFMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFMinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFMixOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFMixOpGenericAdaptorBase::GLFMixOpGenericAdaptorBase(GLFMixOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFMixOpAdaptor::GLFMixOpAdaptor(GLFMixOp op) : GLFMixOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFMixOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFMixOp::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 GLFMixOp::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 GLFMixOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFMixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFMixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFMixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFMixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFMixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(a); odsState.addTypes(result); } GLFMixOp GLFMixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(y), std::forward(a)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMixOp GLFMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(y), std::forward(a)); } void GLFMixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(a); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFMixOp::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); } GLFMixOp GLFMixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(x), std::forward(y), std::forward(a)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMixOp GLFMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { return create(builder, builder.getLoc(), std::forward(x), std::forward(y), std::forward(a)); } void GLFMixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(a); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFMixOp GLFMixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(a)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMixOp GLFMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value a) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(a)); } void GLFMixOp::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); } GLFMixOp GLFMixOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMixOp GLFMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFMixOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFMixOp::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)."); } } GLFMixOp GLFMixOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMixOp GLFMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFMixOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFMixOp GLFMixOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMixOp GLFMixOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFMixOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFMixOp::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)."); } } GLFMixOp GLFMixOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFMixOp GLFMixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFMixOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*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->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).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 {x, y, a, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult GLFMixOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFMixOp::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 GLFMixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand xRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(&xRawOperand, 1); ::llvm::SMLoc xOperandsLoc; (void)xOperandsLoc; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); ::mlir::OpAsmParser::UnresolvedOperand yRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> yOperands(&yRawOperand, 1); ::llvm::SMLoc yOperandsLoc; (void)yOperandsLoc; ::mlir::Type yRawType{}; ::llvm::ArrayRef<::mlir::Type> yTypes(&yRawType, 1); ::mlir::OpAsmParser::UnresolvedOperand aRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> aOperands(&aRawOperand, 1); ::llvm::SMLoc aOperandsLoc; (void)aOperandsLoc; ::mlir::Type aRawType{}; ::llvm::ArrayRef<::mlir::Type> aTypes(&aRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } xOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(xRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); xRawType = type; } if (parser.parseComma()) return ::mlir::failure(); yOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(yRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); yRawType = type; } if (parser.parseComma()) return ::mlir::failure(); aOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(aRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); aRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(yOperands, yTypes, yOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(aOperands, aTypes, aOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFMixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getX(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getY(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getY().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getA(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getA().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 GLFMixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFMixOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFSignOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFSignOpGenericAdaptorBase::GLFSignOpGenericAdaptorBase(GLFSignOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFSignOpAdaptor::GLFSignOpAdaptor(GLFSignOp op) : GLFSignOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFSignOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFSignOp::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 GLFSignOp::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 GLFSignOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFSignOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFSignOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFSignOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFSignOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFSignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLFSignOp GLFSignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFSignOp GLFSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLFSignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFSignOp::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); } GLFSignOp GLFSignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFSignOp GLFSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLFSignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFSignOp GLFSignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFSignOp GLFSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLFSignOp::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); } GLFSignOp GLFSignOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFSignOp GLFSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFSignOp::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(GLFSignOp::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)."); } } GLFSignOp GLFSignOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFSignOp GLFSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFSignOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFSignOp GLFSignOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFSignOp GLFSignOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFSignOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFSignOp::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)."); } } GLFSignOp GLFSignOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFSignOp GLFSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFSignOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFSignOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFSignOp::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 GLFSignOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFSignOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLFSignOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFSignOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFindILsbOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFindILsbOpGenericAdaptorBase::GLFindILsbOpGenericAdaptorBase(GLFindILsbOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFindILsbOpAdaptor::GLFindILsbOpAdaptor(GLFindILsbOp op) : GLFindILsbOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFindILsbOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFindILsbOp::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 GLFindILsbOp::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 GLFindILsbOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFindILsbOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFindILsbOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFindILsbOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFindILsbOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFindILsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLFindILsbOp GLFindILsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindILsbOp GLFindILsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLFindILsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFindILsbOp::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); } GLFindILsbOp GLFindILsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindILsbOp GLFindILsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLFindILsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFindILsbOp GLFindILsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindILsbOp GLFindILsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLFindILsbOp::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); } GLFindILsbOp GLFindILsbOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindILsbOp GLFindILsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFindILsbOp::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(GLFindILsbOp::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)."); } } GLFindILsbOp GLFindILsbOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindILsbOp GLFindILsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFindILsbOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFindILsbOp GLFindILsbOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindILsbOp GLFindILsbOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFindILsbOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFindILsbOp::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)."); } } GLFindILsbOp GLFindILsbOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindILsbOp GLFindILsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFindILsbOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFindILsbOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFindILsbOp::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 GLFindILsbOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFindILsbOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLFindILsbOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFindILsbOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFindSMsbOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFindSMsbOpGenericAdaptorBase::GLFindSMsbOpGenericAdaptorBase(GLFindSMsbOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFindSMsbOpAdaptor::GLFindSMsbOpAdaptor(GLFindSMsbOp op) : GLFindSMsbOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFindSMsbOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFindSMsbOp::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 GLFindSMsbOp::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 GLFindSMsbOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFindSMsbOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFindSMsbOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFindSMsbOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFindSMsbOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFindSMsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLFindSMsbOp GLFindSMsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindSMsbOp GLFindSMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLFindSMsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFindSMsbOp::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); } GLFindSMsbOp GLFindSMsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindSMsbOp GLFindSMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLFindSMsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFindSMsbOp GLFindSMsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindSMsbOp GLFindSMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLFindSMsbOp::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); } GLFindSMsbOp GLFindSMsbOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindSMsbOp GLFindSMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFindSMsbOp::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(GLFindSMsbOp::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)."); } } GLFindSMsbOp GLFindSMsbOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindSMsbOp GLFindSMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFindSMsbOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFindSMsbOp GLFindSMsbOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindSMsbOp GLFindSMsbOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFindSMsbOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFindSMsbOp::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)."); } } GLFindSMsbOp GLFindSMsbOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindSMsbOp GLFindSMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFindSMsbOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps24(*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_SPIRVOps24(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFindSMsbOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFindSMsbOp::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 GLFindSMsbOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFindSMsbOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLFindSMsbOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFindSMsbOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFindUMsbOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFindUMsbOpGenericAdaptorBase::GLFindUMsbOpGenericAdaptorBase(GLFindUMsbOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFindUMsbOpAdaptor::GLFindUMsbOpAdaptor(GLFindUMsbOp op) : GLFindUMsbOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFindUMsbOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFindUMsbOp::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 GLFindUMsbOp::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 GLFindUMsbOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFindUMsbOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFindUMsbOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFindUMsbOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFindUMsbOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFindUMsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLFindUMsbOp GLFindUMsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindUMsbOp GLFindUMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLFindUMsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFindUMsbOp::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); } GLFindUMsbOp GLFindUMsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindUMsbOp GLFindUMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLFindUMsbOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFindUMsbOp GLFindUMsbOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindUMsbOp GLFindUMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLFindUMsbOp::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); } GLFindUMsbOp GLFindUMsbOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindUMsbOp GLFindUMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFindUMsbOp::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(GLFindUMsbOp::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)."); } } GLFindUMsbOp GLFindUMsbOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindUMsbOp GLFindUMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFindUMsbOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFindUMsbOp GLFindUMsbOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindUMsbOp GLFindUMsbOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFindUMsbOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFindUMsbOp::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)."); } } GLFindUMsbOp GLFindUMsbOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFindUMsbOp GLFindUMsbOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFindUMsbOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps24(*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_SPIRVOps24(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFindUMsbOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFindUMsbOp::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 GLFindUMsbOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFindUMsbOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLFindUMsbOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFindUMsbOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFloorOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFloorOpGenericAdaptorBase::GLFloorOpGenericAdaptorBase(GLFloorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFloorOpAdaptor::GLFloorOpAdaptor(GLFloorOp op) : GLFloorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFloorOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFloorOp::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 GLFloorOp::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 GLFloorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFloorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFloorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFloorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFloorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLFloorOp GLFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFloorOp GLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFloorOp::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); } GLFloorOp GLFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFloorOp GLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFloorOp GLFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFloorOp GLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLFloorOp::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); } GLFloorOp GLFloorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFloorOp GLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFloorOp::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(GLFloorOp::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)."); } } GLFloorOp GLFloorOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFloorOp GLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFloorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFloorOp GLFloorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFloorOp GLFloorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFloorOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFloorOp::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)."); } } GLFloorOp GLFloorOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFloorOp GLFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFloorOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFloorOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFloorOp::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 GLFloorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFloorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLFloorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFloorOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFmaOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFmaOpGenericAdaptorBase::GLFmaOpGenericAdaptorBase(GLFmaOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFmaOpAdaptor::GLFmaOpAdaptor(GLFmaOp op) : GLFmaOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFmaOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFmaOp::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 GLFmaOp::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 GLFmaOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFmaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFmaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFmaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFmaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); odsState.addTypes(result); } GLFmaOp GLFmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFmaOp GLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(y), std::forward(z)); } void GLFmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFmaOp GLFmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFmaOp GLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); } void GLFmaOp::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); } GLFmaOp GLFmaOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFmaOp GLFmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFmaOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFmaOp GLFmaOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFmaOp GLFmaOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFmaOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFmaOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFmaOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void GLFmaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFmaOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFractOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFractOpGenericAdaptorBase::GLFractOpGenericAdaptorBase(GLFractOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFractOpAdaptor::GLFractOpAdaptor(GLFractOp op) : GLFractOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFractOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFractOp::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 GLFractOp::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 GLFractOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFractOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFractOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFractOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFractOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLFractOp GLFractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFractOp GLFractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLFractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFractOp::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); } GLFractOp GLFractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFractOp GLFractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLFractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFractOp GLFractOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFractOp GLFractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLFractOp::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); } GLFractOp GLFractOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFractOp GLFractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFractOp::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(GLFractOp::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)."); } } GLFractOp GLFractOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFractOp GLFractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLFractOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFractOp GLFractOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFractOp GLFractOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLFractOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLFractOp::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)."); } } GLFractOp GLFractOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFractOp GLFractOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFractOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFractOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLFractOp::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 GLFractOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFractOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLFractOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFractOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLFrexpStructOp definitions //===----------------------------------------------------------------------===// namespace detail { GLFrexpStructOpGenericAdaptorBase::GLFrexpStructOpGenericAdaptorBase(GLFrexpStructOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLFrexpStructOpAdaptor::GLFrexpStructOpAdaptor(GLFrexpStructOp op) : GLFrexpStructOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLFrexpStructOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLFrexpStructOp::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 GLFrexpStructOp::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 GLFrexpStructOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLFrexpStructOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLFrexpStructOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLFrexpStructOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLFrexpStructOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLFrexpStructOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLFrexpStructOp GLFrexpStructOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFrexpStructOp GLFrexpStructOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLFrexpStructOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLFrexpStructOp GLFrexpStructOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFrexpStructOp GLFrexpStructOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLFrexpStructOp::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); } GLFrexpStructOp GLFrexpStructOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFrexpStructOp GLFrexpStructOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLFrexpStructOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLFrexpStructOp GLFrexpStructOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLFrexpStructOp GLFrexpStructOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLFrexpStructOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps25(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLFrexpStructOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GLFrexpStructOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLFrexpStructOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 GLFrexpStructOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLFrexpStructOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLInverseSqrtOp definitions //===----------------------------------------------------------------------===// namespace detail { GLInverseSqrtOpGenericAdaptorBase::GLInverseSqrtOpGenericAdaptorBase(GLInverseSqrtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLInverseSqrtOpAdaptor::GLInverseSqrtOpAdaptor(GLInverseSqrtOp op) : GLInverseSqrtOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLInverseSqrtOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLInverseSqrtOp::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 GLInverseSqrtOp::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 GLInverseSqrtOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLInverseSqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLInverseSqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLInverseSqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLInverseSqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLInverseSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLInverseSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLInverseSqrtOp::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); } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLInverseSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLInverseSqrtOp::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); } GLInverseSqrtOp GLInverseSqrtOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLInverseSqrtOp::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(GLInverseSqrtOp::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)."); } } GLInverseSqrtOp GLInverseSqrtOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLInverseSqrtOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLInverseSqrtOp GLInverseSqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLInverseSqrtOp GLInverseSqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLInverseSqrtOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLInverseSqrtOp::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)."); } } GLInverseSqrtOp GLInverseSqrtOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLInverseSqrtOp GLInverseSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLInverseSqrtOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLInverseSqrtOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLInverseSqrtOp::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 GLInverseSqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLInverseSqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLInverseSqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLInverseSqrtOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLLdexpOp definitions //===----------------------------------------------------------------------===// namespace detail { GLLdexpOpGenericAdaptorBase::GLLdexpOpGenericAdaptorBase(GLLdexpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLLdexpOpAdaptor::GLLdexpOpAdaptor(GLLdexpOp op) : GLLdexpOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLLdexpOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLLdexpOp::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 GLLdexpOp::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 GLLdexpOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLLdexpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLLdexpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLLdexpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLLdexpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLLdexpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value exp) { odsState.addOperands(x); odsState.addOperands(exp); odsState.addTypes(y); } GLLdexpOp GLLdexpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type y, ::mlir::Value x, ::mlir::Value exp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(y), std::forward(x), std::forward(exp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLdexpOp GLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type y, ::mlir::Value x, ::mlir::Value exp) { return create(builder, builder.getLoc(), std::forward(y), std::forward(x), std::forward(exp)); } void GLLdexpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value exp) { odsState.addOperands(x); odsState.addOperands(exp); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLLdexpOp::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); } GLLdexpOp GLLdexpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value exp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(x), std::forward(exp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLdexpOp GLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value exp) { return create(builder, builder.getLoc(), std::forward(x), std::forward(exp)); } void GLLdexpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value exp) { odsState.addOperands(x); odsState.addOperands(exp); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLLdexpOp GLLdexpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value exp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(exp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLdexpOp GLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value exp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(exp)); } void GLLdexpOp::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); } GLLdexpOp GLLdexpOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLdexpOp GLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLLdexpOp::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(GLLdexpOp::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)."); } } GLLdexpOp GLLdexpOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLdexpOp GLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLLdexpOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLLdexpOp GLLdexpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLdexpOp GLLdexpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLLdexpOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLLdexpOp::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)."); } } GLLdexpOp GLLdexpOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLdexpOp GLLdexpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLLdexpOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, y} have same type"); return ::mlir::success(); } ::llvm::LogicalResult GLLdexpOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GLLdexpOp::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 GLLdexpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand xRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(&xRawOperand, 1); ::llvm::SMLoc xOperandsLoc; (void)xOperandsLoc; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); ::mlir::OpAsmParser::UnresolvedOperand expRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> expOperands(&expRawOperand, 1); ::llvm::SMLoc expOperandsLoc; (void)expOperandsLoc; ::mlir::Type expRawType{}; ::llvm::ArrayRef<::mlir::Type> expTypes(&expRawType, 1); ::mlir::Type yRawType{}; ::llvm::ArrayRef<::mlir::Type> yTypes(&yRawType, 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(); } xOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(xRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); xRawType = type; } if (parser.parseComma()) return ::mlir::failure(); expOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(expRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); expRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); yRawType = type; } result.addTypes(yTypes); if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(expOperands, expTypes, expOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLLdexpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getX(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getExp(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getExp().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getY().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GLLdexpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLLdexpOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLLengthOp definitions //===----------------------------------------------------------------------===// namespace detail { GLLengthOpGenericAdaptorBase::GLLengthOpGenericAdaptorBase(GLLengthOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLLengthOpAdaptor::GLLengthOpAdaptor(GLLengthOp op) : GLLengthOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLLengthOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLLengthOp::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 GLLengthOp::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 GLLengthOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLLengthOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLLengthOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLLengthOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLLengthOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLLengthOp GLLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLengthOp GLLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLLengthOp::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); } GLLengthOp GLLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLengthOp GLLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLLengthOp GLLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLengthOp GLLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLLengthOp::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); } GLLengthOp GLLengthOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLengthOp GLLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLLengthOp::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(GLLengthOp::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)."); } } GLLengthOp GLLengthOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLengthOp GLLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLLengthOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLLengthOp GLLengthOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLengthOp GLLengthOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLLengthOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLLengthOp::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)."); } } GLLengthOp GLLengthOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLengthOp GLLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLLengthOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps17(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(::mlir::getElementTypeOrSelf((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that result type must match operand element type"); return ::mlir::success(); } ::llvm::LogicalResult GLLengthOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLLengthOp::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 = ::mlir::getElementTypeOrSelf(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult GLLengthOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLLengthOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 GLLengthOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLLengthOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLLog2Op definitions //===----------------------------------------------------------------------===// namespace detail { GLLog2OpGenericAdaptorBase::GLLog2OpGenericAdaptorBase(GLLog2Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLLog2OpAdaptor::GLLog2OpAdaptor(GLLog2Op op) : GLLog2OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLLog2OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLLog2Op::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 GLLog2Op::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 GLLog2Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLLog2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLLog2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLLog2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLLog2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLLog2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLLog2Op GLLog2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLog2Op GLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLLog2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLLog2Op::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); } GLLog2Op GLLog2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLog2Op GLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLLog2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLLog2Op GLLog2Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLog2Op GLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLLog2Op::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); } GLLog2Op GLLog2Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLog2Op GLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLLog2Op::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(GLLog2Op::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)."); } } GLLog2Op GLLog2Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLog2Op GLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLLog2Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLLog2Op GLLog2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLog2Op GLLog2Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLLog2Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLLog2Op::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)."); } } GLLog2Op GLLog2Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLog2Op GLLog2Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLLog2Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLLog2Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLLog2Op::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 GLLog2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLLog2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLLog2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLLog2Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLLogOp definitions //===----------------------------------------------------------------------===// namespace detail { GLLogOpGenericAdaptorBase::GLLogOpGenericAdaptorBase(GLLogOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLLogOpAdaptor::GLLogOpAdaptor(GLLogOp op) : GLLogOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLLogOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLLogOp::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 GLLogOp::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 GLLogOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLLogOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLLogOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLLogOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLLogOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLLogOp GLLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLogOp GLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLLogOp::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); } GLLogOp GLLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLogOp GLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLLogOp GLLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLogOp GLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLLogOp::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); } GLLogOp GLLogOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLogOp GLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLLogOp::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(GLLogOp::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)."); } } GLLogOp GLLogOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLogOp GLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLLogOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLLogOp GLLogOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLogOp GLLogOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLLogOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLLogOp::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)."); } } GLLogOp GLLogOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLLogOp GLLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLLogOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLLogOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLLogOp::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 GLLogOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLLogOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLLogOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLLogOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLNormalizeOp definitions //===----------------------------------------------------------------------===// namespace detail { GLNormalizeOpGenericAdaptorBase::GLNormalizeOpGenericAdaptorBase(GLNormalizeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLNormalizeOpAdaptor::GLNormalizeOpAdaptor(GLNormalizeOp op) : GLNormalizeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLNormalizeOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLNormalizeOp::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 GLNormalizeOp::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 GLNormalizeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLNormalizeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLNormalizeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLNormalizeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLNormalizeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLNormalizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLNormalizeOp GLNormalizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLNormalizeOp GLNormalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLNormalizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLNormalizeOp::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); } GLNormalizeOp GLNormalizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLNormalizeOp GLNormalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLNormalizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLNormalizeOp GLNormalizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLNormalizeOp GLNormalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLNormalizeOp::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); } GLNormalizeOp GLNormalizeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLNormalizeOp GLNormalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLNormalizeOp::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(GLNormalizeOp::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)."); } } GLNormalizeOp GLNormalizeOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLNormalizeOp GLNormalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLNormalizeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLNormalizeOp GLNormalizeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLNormalizeOp GLNormalizeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLNormalizeOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLNormalizeOp::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)."); } } GLNormalizeOp GLNormalizeOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLNormalizeOp GLNormalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLNormalizeOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLNormalizeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLNormalizeOp::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 GLNormalizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLNormalizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLNormalizeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLNormalizeOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLPackHalf2x16Op definitions //===----------------------------------------------------------------------===// namespace detail { GLPackHalf2x16OpGenericAdaptorBase::GLPackHalf2x16OpGenericAdaptorBase(GLPackHalf2x16Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLPackHalf2x16OpAdaptor::GLPackHalf2x16OpAdaptor(GLPackHalf2x16Op op) : GLPackHalf2x16OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLPackHalf2x16OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLPackHalf2x16Op::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 GLPackHalf2x16Op::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 GLPackHalf2x16Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLPackHalf2x16Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLPackHalf2x16Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLPackHalf2x16Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLPackHalf2x16Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLPackHalf2x16Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLPackHalf2x16Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLPackHalf2x16Op::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); } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLPackHalf2x16Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLPackHalf2x16Op::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); } GLPackHalf2x16Op GLPackHalf2x16Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLPackHalf2x16Op::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(GLPackHalf2x16Op::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)."); } } GLPackHalf2x16Op GLPackHalf2x16Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLPackHalf2x16Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLPackHalf2x16Op GLPackHalf2x16Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackHalf2x16Op GLPackHalf2x16Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLPackHalf2x16Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLPackHalf2x16Op::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)."); } } GLPackHalf2x16Op GLPackHalf2x16Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackHalf2x16Op GLPackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLPackHalf2x16Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps26(*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_SPIRVOps27(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLPackHalf2x16Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLPackHalf2x16Op::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 GLPackHalf2x16Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLPackHalf2x16Op::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GLPackHalf2x16Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLPackHalf2x16Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLPackSnorm4x8Op definitions //===----------------------------------------------------------------------===// namespace detail { GLPackSnorm4x8OpGenericAdaptorBase::GLPackSnorm4x8OpGenericAdaptorBase(GLPackSnorm4x8Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLPackSnorm4x8OpAdaptor::GLPackSnorm4x8OpAdaptor(GLPackSnorm4x8Op op) : GLPackSnorm4x8OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLPackSnorm4x8OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLPackSnorm4x8Op::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 GLPackSnorm4x8Op::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 GLPackSnorm4x8Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLPackSnorm4x8Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLPackSnorm4x8Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLPackSnorm4x8Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLPackSnorm4x8Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLPackSnorm4x8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLPackSnorm4x8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLPackSnorm4x8Op::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); } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLPackSnorm4x8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLPackSnorm4x8Op::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); } GLPackSnorm4x8Op GLPackSnorm4x8Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLPackSnorm4x8Op::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(GLPackSnorm4x8Op::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)."); } } GLPackSnorm4x8Op GLPackSnorm4x8Op::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLPackSnorm4x8Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLPackSnorm4x8Op GLPackSnorm4x8Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackSnorm4x8Op GLPackSnorm4x8Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLPackSnorm4x8Op::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLPackSnorm4x8Op::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)."); } } GLPackSnorm4x8Op GLPackSnorm4x8Op::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPackSnorm4x8Op GLPackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLPackSnorm4x8Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps28(*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_SPIRVOps27(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLPackSnorm4x8Op::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLPackSnorm4x8Op::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 GLPackSnorm4x8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLPackSnorm4x8Op::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GLPackSnorm4x8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLPackSnorm4x8Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLPowOp definitions //===----------------------------------------------------------------------===// namespace detail { GLPowOpGenericAdaptorBase::GLPowOpGenericAdaptorBase(GLPowOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLPowOpAdaptor::GLPowOpAdaptor(GLPowOp op) : GLPowOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLPowOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLPowOp::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 GLPowOp::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 GLPowOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLPowOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLPowOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLPowOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLPowOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLPowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLPowOp GLPowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPowOp GLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLPowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLPowOp::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); } GLPowOp GLPowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPowOp GLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLPowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLPowOp GLPowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPowOp GLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLPowOp::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); } GLPowOp GLPowOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPowOp GLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLPowOp::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(GLPowOp::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)."); } } GLPowOp GLPowOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPowOp GLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLPowOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLPowOp GLPowOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPowOp GLPowOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLPowOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLPowOp::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)."); } } GLPowOp GLPowOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLPowOp GLPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLPowOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLPowOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLPowOp::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 GLPowOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLPowOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLPowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLPowOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLRadiansOp definitions //===----------------------------------------------------------------------===// namespace detail { GLRadiansOpGenericAdaptorBase::GLRadiansOpGenericAdaptorBase(GLRadiansOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLRadiansOpAdaptor::GLRadiansOpAdaptor(GLRadiansOp op) : GLRadiansOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLRadiansOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLRadiansOp::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 GLRadiansOp::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 GLRadiansOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLRadiansOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLRadiansOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLRadiansOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLRadiansOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLRadiansOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLRadiansOp GLRadiansOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRadiansOp GLRadiansOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLRadiansOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLRadiansOp::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); } GLRadiansOp GLRadiansOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRadiansOp GLRadiansOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLRadiansOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLRadiansOp GLRadiansOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRadiansOp GLRadiansOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLRadiansOp::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); } GLRadiansOp GLRadiansOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRadiansOp GLRadiansOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLRadiansOp::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(GLRadiansOp::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)."); } } GLRadiansOp GLRadiansOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRadiansOp GLRadiansOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLRadiansOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLRadiansOp GLRadiansOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRadiansOp GLRadiansOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLRadiansOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLRadiansOp::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)."); } } GLRadiansOp GLRadiansOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRadiansOp GLRadiansOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLRadiansOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLRadiansOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLRadiansOp::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 GLRadiansOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLRadiansOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLRadiansOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLRadiansOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLReflectOp definitions //===----------------------------------------------------------------------===// namespace detail { GLReflectOpGenericAdaptorBase::GLReflectOpGenericAdaptorBase(GLReflectOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLReflectOpAdaptor::GLReflectOpAdaptor(GLReflectOp op) : GLReflectOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLReflectOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLReflectOp::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 GLReflectOp::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 GLReflectOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLReflectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLReflectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLReflectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLReflectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLReflectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLReflectOp GLReflectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLReflectOp GLReflectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLReflectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLReflectOp::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); } GLReflectOp GLReflectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLReflectOp GLReflectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLReflectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLReflectOp GLReflectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLReflectOp GLReflectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLReflectOp::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); } GLReflectOp GLReflectOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLReflectOp GLReflectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLReflectOp::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(GLReflectOp::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)."); } } GLReflectOp GLReflectOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLReflectOp GLReflectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLReflectOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLReflectOp GLReflectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLReflectOp GLReflectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLReflectOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLReflectOp::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)."); } } GLReflectOp GLReflectOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLReflectOp GLReflectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLReflectOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLReflectOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLReflectOp::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 GLReflectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLReflectOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLReflectOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLReflectOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLRoundEvenOp definitions //===----------------------------------------------------------------------===// namespace detail { GLRoundEvenOpGenericAdaptorBase::GLRoundEvenOpGenericAdaptorBase(GLRoundEvenOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLRoundEvenOpAdaptor::GLRoundEvenOpAdaptor(GLRoundEvenOp op) : GLRoundEvenOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLRoundEvenOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLRoundEvenOp::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 GLRoundEvenOp::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 GLRoundEvenOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLRoundEvenOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLRoundEvenOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLRoundEvenOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLRoundEvenOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLRoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLRoundEvenOp GLRoundEvenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundEvenOp GLRoundEvenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLRoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLRoundEvenOp::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); } GLRoundEvenOp GLRoundEvenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundEvenOp GLRoundEvenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLRoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLRoundEvenOp GLRoundEvenOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundEvenOp GLRoundEvenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLRoundEvenOp::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); } GLRoundEvenOp GLRoundEvenOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundEvenOp GLRoundEvenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLRoundEvenOp::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(GLRoundEvenOp::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)."); } } GLRoundEvenOp GLRoundEvenOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundEvenOp GLRoundEvenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLRoundEvenOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLRoundEvenOp GLRoundEvenOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundEvenOp GLRoundEvenOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLRoundEvenOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLRoundEvenOp::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)."); } } GLRoundEvenOp GLRoundEvenOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundEvenOp GLRoundEvenOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLRoundEvenOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLRoundEvenOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLRoundEvenOp::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 GLRoundEvenOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLRoundEvenOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLRoundEvenOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLRoundEvenOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLRoundOp definitions //===----------------------------------------------------------------------===// namespace detail { GLRoundOpGenericAdaptorBase::GLRoundOpGenericAdaptorBase(GLRoundOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLRoundOpAdaptor::GLRoundOpAdaptor(GLRoundOp op) : GLRoundOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLRoundOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLRoundOp::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 GLRoundOp::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 GLRoundOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLRoundOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLRoundOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLRoundOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLRoundOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLRoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLRoundOp GLRoundOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundOp GLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLRoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLRoundOp::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); } GLRoundOp GLRoundOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundOp GLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLRoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLRoundOp GLRoundOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundOp GLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLRoundOp::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); } GLRoundOp GLRoundOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundOp GLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLRoundOp::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(GLRoundOp::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)."); } } GLRoundOp GLRoundOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundOp GLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLRoundOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLRoundOp GLRoundOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundOp GLRoundOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLRoundOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLRoundOp::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)."); } } GLRoundOp GLRoundOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLRoundOp GLRoundOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLRoundOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLRoundOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLRoundOp::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 GLRoundOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLRoundOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLRoundOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLRoundOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLSAbsOp definitions //===----------------------------------------------------------------------===// namespace detail { GLSAbsOpGenericAdaptorBase::GLSAbsOpGenericAdaptorBase(GLSAbsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLSAbsOpAdaptor::GLSAbsOpAdaptor(GLSAbsOp op) : GLSAbsOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLSAbsOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLSAbsOp::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 GLSAbsOp::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 GLSAbsOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLSAbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLSAbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLSAbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLSAbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLSAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLSAbsOp GLSAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSAbsOp GLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLSAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSAbsOp::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); } GLSAbsOp GLSAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSAbsOp GLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLSAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLSAbsOp GLSAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSAbsOp GLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLSAbsOp::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); } GLSAbsOp GLSAbsOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSAbsOp GLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLSAbsOp::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(GLSAbsOp::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)."); } } GLSAbsOp GLSAbsOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSAbsOp GLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLSAbsOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLSAbsOp GLSAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSAbsOp GLSAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLSAbsOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSAbsOp::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)."); } } GLSAbsOp GLSAbsOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSAbsOp GLSAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLSAbsOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLSAbsOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLSAbsOp::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 GLSAbsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLSAbsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLSAbsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLSAbsOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLSClampOp definitions //===----------------------------------------------------------------------===// namespace detail { GLSClampOpGenericAdaptorBase::GLSClampOpGenericAdaptorBase(GLSClampOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLSClampOpAdaptor::GLSClampOpAdaptor(GLSClampOp op) : GLSClampOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLSClampOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLSClampOp::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 GLSClampOp::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 GLSClampOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLSClampOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLSClampOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLSClampOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLSClampOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLSClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); odsState.addTypes(result); } GLSClampOp GLSClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSClampOp GLSClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(y), std::forward(z)); } void GLSClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLSClampOp GLSClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSClampOp GLSClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); } void GLSClampOp::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); } GLSClampOp GLSClampOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSClampOp GLSClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLSClampOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLSClampOp GLSClampOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSClampOp GLSClampOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLSClampOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLSClampOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLSClampOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void GLSClampOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLSClampOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLSMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GLSMaxOpGenericAdaptorBase::GLSMaxOpGenericAdaptorBase(GLSMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLSMaxOpAdaptor::GLSMaxOpAdaptor(GLSMaxOp op) : GLSMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLSMaxOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLSMaxOp::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 GLSMaxOp::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 GLSMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLSMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLSMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLSMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLSMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLSMaxOp GLSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMaxOp GLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSMaxOp::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); } GLSMaxOp GLSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMaxOp GLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLSMaxOp GLSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMaxOp GLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLSMaxOp::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); } GLSMaxOp GLSMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMaxOp GLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLSMaxOp::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(GLSMaxOp::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)."); } } GLSMaxOp GLSMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMaxOp GLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLSMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLSMaxOp GLSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMaxOp GLSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLSMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSMaxOp::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)."); } } GLSMaxOp GLSMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMaxOp GLSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLSMaxOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLSMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLSMaxOp::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 GLSMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLSMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLSMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLSMaxOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLSMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GLSMinOpGenericAdaptorBase::GLSMinOpGenericAdaptorBase(GLSMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLSMinOpAdaptor::GLSMinOpAdaptor(GLSMinOp op) : GLSMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLSMinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLSMinOp::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 GLSMinOp::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 GLSMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLSMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLSMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLSMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLSMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLSMinOp GLSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMinOp GLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSMinOp::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); } GLSMinOp GLSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMinOp GLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLSMinOp GLSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMinOp GLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLSMinOp::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); } GLSMinOp GLSMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMinOp GLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLSMinOp::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(GLSMinOp::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)."); } } GLSMinOp GLSMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMinOp GLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLSMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLSMinOp GLSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMinOp GLSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLSMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSMinOp::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)."); } } GLSMinOp GLSMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSMinOp GLSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLSMinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLSMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLSMinOp::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 GLSMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLSMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLSMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLSMinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLSSignOp definitions //===----------------------------------------------------------------------===// namespace detail { GLSSignOpGenericAdaptorBase::GLSSignOpGenericAdaptorBase(GLSSignOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLSSignOpAdaptor::GLSSignOpAdaptor(GLSSignOp op) : GLSSignOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLSSignOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLSSignOp::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 GLSSignOp::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 GLSSignOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLSSignOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLSSignOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLSSignOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLSSignOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLSSignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLSSignOp GLSSignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSSignOp GLSSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLSSignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSSignOp::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); } GLSSignOp GLSSignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSSignOp GLSSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLSSignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLSSignOp GLSSignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSSignOp GLSSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLSSignOp::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); } GLSSignOp GLSSignOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSSignOp GLSSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLSSignOp::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(GLSSignOp::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)."); } } GLSSignOp GLSSignOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSSignOp GLSSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLSSignOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLSSignOp GLSSignOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSSignOp GLSSignOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLSSignOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSSignOp::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)."); } } GLSSignOp GLSSignOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSSignOp GLSSignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLSSignOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLSSignOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLSSignOp::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 GLSSignOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLSSignOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLSSignOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLSSignOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLSinOp definitions //===----------------------------------------------------------------------===// namespace detail { GLSinOpGenericAdaptorBase::GLSinOpGenericAdaptorBase(GLSinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLSinOpAdaptor::GLSinOpAdaptor(GLSinOp op) : GLSinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLSinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLSinOp::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 GLSinOp::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 GLSinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLSinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLSinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLSinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLSinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLSinOp GLSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinOp GLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSinOp::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); } GLSinOp GLSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinOp GLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLSinOp GLSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinOp GLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLSinOp::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); } GLSinOp GLSinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinOp GLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLSinOp::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(GLSinOp::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)."); } } GLSinOp GLSinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinOp GLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLSinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLSinOp GLSinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinOp GLSinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLSinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSinOp::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)."); } } GLSinOp GLSinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinOp GLSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLSinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLSinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLSinOp::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 GLSinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLSinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLSinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLSinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLSinhOp definitions //===----------------------------------------------------------------------===// namespace detail { GLSinhOpGenericAdaptorBase::GLSinhOpGenericAdaptorBase(GLSinhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLSinhOpAdaptor::GLSinhOpAdaptor(GLSinhOp op) : GLSinhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLSinhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLSinhOp::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 GLSinhOp::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 GLSinhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLSinhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLSinhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLSinhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLSinhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLSinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLSinhOp GLSinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinhOp GLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLSinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSinhOp::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); } GLSinhOp GLSinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinhOp GLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLSinhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLSinhOp GLSinhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinhOp GLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLSinhOp::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); } GLSinhOp GLSinhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinhOp GLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLSinhOp::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(GLSinhOp::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)."); } } GLSinhOp GLSinhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinhOp GLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLSinhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLSinhOp GLSinhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinhOp GLSinhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLSinhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSinhOp::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)."); } } GLSinhOp GLSinhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSinhOp GLSinhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLSinhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLSinhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLSinhOp::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 GLSinhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLSinhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLSinhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLSinhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLSqrtOp definitions //===----------------------------------------------------------------------===// namespace detail { GLSqrtOpGenericAdaptorBase::GLSqrtOpGenericAdaptorBase(GLSqrtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLSqrtOpAdaptor::GLSqrtOpAdaptor(GLSqrtOp op) : GLSqrtOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLSqrtOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLSqrtOp::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 GLSqrtOp::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 GLSqrtOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLSqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLSqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLSqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLSqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLSqrtOp GLSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSqrtOp GLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSqrtOp::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); } GLSqrtOp GLSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSqrtOp GLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLSqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLSqrtOp GLSqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSqrtOp GLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLSqrtOp::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); } GLSqrtOp GLSqrtOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSqrtOp GLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLSqrtOp::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(GLSqrtOp::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)."); } } GLSqrtOp GLSqrtOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSqrtOp GLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLSqrtOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLSqrtOp GLSqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSqrtOp GLSqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLSqrtOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLSqrtOp::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)."); } } GLSqrtOp GLSqrtOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLSqrtOp GLSqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLSqrtOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLSqrtOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLSqrtOp::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 GLSqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLSqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLSqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLSqrtOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLTanOp definitions //===----------------------------------------------------------------------===// namespace detail { GLTanOpGenericAdaptorBase::GLTanOpGenericAdaptorBase(GLTanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLTanOpAdaptor::GLTanOpAdaptor(GLTanOp op) : GLTanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLTanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLTanOp::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 GLTanOp::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 GLTanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLTanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLTanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLTanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLTanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLTanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLTanOp GLTanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanOp GLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLTanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLTanOp::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); } GLTanOp GLTanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanOp GLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLTanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLTanOp GLTanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanOp GLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLTanOp::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); } GLTanOp GLTanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanOp GLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLTanOp::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(GLTanOp::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)."); } } GLTanOp GLTanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanOp GLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLTanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLTanOp GLTanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanOp GLTanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLTanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLTanOp::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)."); } } GLTanOp GLTanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanOp GLTanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLTanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLTanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLTanOp::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 GLTanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLTanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLTanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLTanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLTanhOp definitions //===----------------------------------------------------------------------===// namespace detail { GLTanhOpGenericAdaptorBase::GLTanhOpGenericAdaptorBase(GLTanhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLTanhOpAdaptor::GLTanhOpAdaptor(GLTanhOp op) : GLTanhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLTanhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLTanhOp::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 GLTanhOp::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 GLTanhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLTanhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLTanhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLTanhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLTanhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLTanhOp GLTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanhOp GLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLTanhOp::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); } GLTanhOp GLTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanhOp GLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLTanhOp GLTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanhOp GLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLTanhOp::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); } GLTanhOp GLTanhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanhOp GLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLTanhOp::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(GLTanhOp::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)."); } } GLTanhOp GLTanhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanhOp GLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLTanhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLTanhOp GLTanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanhOp GLTanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLTanhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLTanhOp::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)."); } } GLTanhOp GLTanhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTanhOp GLTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLTanhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps23(*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_SPIRVOps23(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLTanhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLTanhOp::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 GLTanhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLTanhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLTanhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLTanhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLTruncOp definitions //===----------------------------------------------------------------------===// namespace detail { GLTruncOpGenericAdaptorBase::GLTruncOpGenericAdaptorBase(GLTruncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLTruncOpAdaptor::GLTruncOpAdaptor(GLTruncOp op) : GLTruncOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLTruncOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLTruncOp::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 GLTruncOp::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 GLTruncOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLTruncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLTruncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLTruncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLTruncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLTruncOp GLTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTruncOp GLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLTruncOp::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); } GLTruncOp GLTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTruncOp GLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void GLTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLTruncOp GLTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTruncOp GLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLTruncOp::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); } GLTruncOp GLTruncOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTruncOp GLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLTruncOp::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(GLTruncOp::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)."); } } GLTruncOp GLTruncOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTruncOp GLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLTruncOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLTruncOp GLTruncOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTruncOp GLTruncOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLTruncOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLTruncOp::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)."); } } GLTruncOp GLTruncOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLTruncOp GLTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLTruncOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLTruncOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLTruncOp::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 GLTruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLTruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void GLTruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLTruncOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLUClampOp definitions //===----------------------------------------------------------------------===// namespace detail { GLUClampOpGenericAdaptorBase::GLUClampOpGenericAdaptorBase(GLUClampOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLUClampOpAdaptor::GLUClampOpAdaptor(GLUClampOp op) : GLUClampOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLUClampOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLUClampOp::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 GLUClampOp::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 GLUClampOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLUClampOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLUClampOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLUClampOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLUClampOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLUClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); odsState.addTypes(result); } GLUClampOp GLUClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUClampOp GLUClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(result), std::forward(x), std::forward(y), std::forward(z)); } void GLUClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { odsState.addOperands(x); odsState.addOperands(y); odsState.addOperands(z); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLUClampOp GLUClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUClampOp GLUClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, ::mlir::Value z) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(x), std::forward(y), std::forward(z)); } void GLUClampOp::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); } GLUClampOp GLUClampOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUClampOp GLUClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLUClampOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLUClampOp GLUClampOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUClampOp GLUClampOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLUClampOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLUClampOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLUClampOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void GLUClampOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLUClampOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLUMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GLUMaxOpGenericAdaptorBase::GLUMaxOpGenericAdaptorBase(GLUMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLUMaxOpAdaptor::GLUMaxOpAdaptor(GLUMaxOp op) : GLUMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLUMaxOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLUMaxOp::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 GLUMaxOp::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 GLUMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLUMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLUMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLUMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLUMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLUMaxOp GLUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMaxOp GLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLUMaxOp::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); } GLUMaxOp GLUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMaxOp GLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLUMaxOp GLUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMaxOp GLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLUMaxOp::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); } GLUMaxOp GLUMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMaxOp GLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLUMaxOp::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(GLUMaxOp::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)."); } } GLUMaxOp GLUMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMaxOp GLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLUMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLUMaxOp GLUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMaxOp GLUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLUMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLUMaxOp::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)."); } } GLUMaxOp GLUMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMaxOp GLUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLUMaxOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLUMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLUMaxOp::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 GLUMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLUMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLUMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLUMaxOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLUMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GLUMinOpGenericAdaptorBase::GLUMinOpGenericAdaptorBase(GLUMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLUMinOpAdaptor::GLUMinOpAdaptor(GLUMinOp op) : GLUMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLUMinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLUMinOp::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 GLUMinOp::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 GLUMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLUMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLUMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLUMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLUMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); odsState.addTypes(result); } GLUMinOp GLUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMinOp GLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(result), std::forward(lhs), std::forward(rhs)); } void GLUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLUMinOp::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); } GLUMinOp GLUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMinOp GLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(lhs), std::forward(rhs)); } void GLUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { odsState.addOperands(lhs); odsState.addOperands(rhs); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLUMinOp GLUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMinOp GLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(lhs), std::forward(rhs)); } void GLUMinOp::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); } GLUMinOp GLUMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMinOp GLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLUMinOp::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(GLUMinOp::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)."); } } GLUMinOp GLUMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMinOp GLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GLUMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLUMinOp GLUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMinOp GLUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GLUMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GLUMinOp::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)."); } } GLUMinOp GLUMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUMinOp GLUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLUMinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLUMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GLUMinOp::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 GLUMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLUMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 GLUMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLUMinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLUnpackHalf2x16Op definitions //===----------------------------------------------------------------------===// namespace detail { GLUnpackHalf2x16OpGenericAdaptorBase::GLUnpackHalf2x16OpGenericAdaptorBase(GLUnpackHalf2x16Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLUnpackHalf2x16OpAdaptor::GLUnpackHalf2x16OpAdaptor(GLUnpackHalf2x16Op op) : GLUnpackHalf2x16OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLUnpackHalf2x16OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLUnpackHalf2x16Op::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 GLUnpackHalf2x16Op::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 GLUnpackHalf2x16Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLUnpackHalf2x16Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLUnpackHalf2x16Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLUnpackHalf2x16Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLUnpackHalf2x16Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLUnpackHalf2x16Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLUnpackHalf2x16Op GLUnpackHalf2x16Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUnpackHalf2x16Op GLUnpackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLUnpackHalf2x16Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLUnpackHalf2x16Op GLUnpackHalf2x16Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUnpackHalf2x16Op GLUnpackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLUnpackHalf2x16Op::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); } GLUnpackHalf2x16Op GLUnpackHalf2x16Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUnpackHalf2x16Op GLUnpackHalf2x16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLUnpackHalf2x16Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLUnpackHalf2x16Op GLUnpackHalf2x16Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUnpackHalf2x16Op GLUnpackHalf2x16Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLUnpackHalf2x16Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps27(*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_SPIRVOps26(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLUnpackHalf2x16Op::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult GLUnpackHalf2x16Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLUnpackHalf2x16Op::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GLUnpackHalf2x16Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLUnpackHalf2x16Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GLUnpackSnorm4x8Op definitions //===----------------------------------------------------------------------===// namespace detail { GLUnpackSnorm4x8OpGenericAdaptorBase::GLUnpackSnorm4x8OpGenericAdaptorBase(GLUnpackSnorm4x8Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GLUnpackSnorm4x8OpAdaptor::GLUnpackSnorm4x8OpAdaptor(GLUnpackSnorm4x8Op op) : GLUnpackSnorm4x8OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GLUnpackSnorm4x8OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GLUnpackSnorm4x8Op::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 GLUnpackSnorm4x8Op::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 GLUnpackSnorm4x8Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GLUnpackSnorm4x8Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GLUnpackSnorm4x8Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GLUnpackSnorm4x8Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GLUnpackSnorm4x8Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GLUnpackSnorm4x8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } GLUnpackSnorm4x8Op GLUnpackSnorm4x8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUnpackSnorm4x8Op GLUnpackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void GLUnpackSnorm4x8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GLUnpackSnorm4x8Op GLUnpackSnorm4x8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUnpackSnorm4x8Op GLUnpackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void GLUnpackSnorm4x8Op::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); } GLUnpackSnorm4x8Op GLUnpackSnorm4x8Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUnpackSnorm4x8Op GLUnpackSnorm4x8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GLUnpackSnorm4x8Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GLUnpackSnorm4x8Op GLUnpackSnorm4x8Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GLUnpackSnorm4x8Op GLUnpackSnorm4x8Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GLUnpackSnorm4x8Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps27(*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_SPIRVOps28(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GLUnpackSnorm4x8Op::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult GLUnpackSnorm4x8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GLUnpackSnorm4x8Op::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GLUnpackSnorm4x8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GLUnpackSnorm4x8Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GenericCastToPtrExplicitOp definitions //===----------------------------------------------------------------------===// namespace detail { GenericCastToPtrExplicitOpGenericAdaptorBase::GenericCastToPtrExplicitOpGenericAdaptorBase(GenericCastToPtrExplicitOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GenericCastToPtrExplicitOpAdaptor::GenericCastToPtrExplicitOpAdaptor(GenericCastToPtrExplicitOp op) : GenericCastToPtrExplicitOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GenericCastToPtrExplicitOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GenericCastToPtrExplicitOp::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 GenericCastToPtrExplicitOp::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 GenericCastToPtrExplicitOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GenericCastToPtrExplicitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GenericCastToPtrExplicitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GenericCastToPtrExplicitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GenericCastToPtrExplicitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GenericCastToPtrExplicitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer) { odsState.addOperands(pointer); odsState.addTypes(result); } GenericCastToPtrExplicitOp GenericCastToPtrExplicitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GenericCastToPtrExplicitOp GenericCastToPtrExplicitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer)); } void GenericCastToPtrExplicitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { odsState.addOperands(pointer); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GenericCastToPtrExplicitOp GenericCastToPtrExplicitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GenericCastToPtrExplicitOp GenericCastToPtrExplicitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer)); } void GenericCastToPtrExplicitOp::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); } GenericCastToPtrExplicitOp GenericCastToPtrExplicitOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GenericCastToPtrExplicitOp GenericCastToPtrExplicitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GenericCastToPtrExplicitOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GenericCastToPtrExplicitOp GenericCastToPtrExplicitOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GenericCastToPtrExplicitOp GenericCastToPtrExplicitOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GenericCastToPtrExplicitOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GenericCastToPtrExplicitOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GenericCastToPtrExplicitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand pointerRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pointerOperands(&pointerRawOperand, 1); ::llvm::SMLoc pointerOperandsLoc; (void)pointerOperandsLoc; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); pointerOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(pointerRawOperand)) 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(); pointerRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(pointerOperands, pointerTypes, pointerOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GenericCastToPtrExplicitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPointer(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GenericCastToPtrExplicitOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GenericCastToPtrExplicitOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GenericCastToPtrOp definitions //===----------------------------------------------------------------------===// namespace detail { GenericCastToPtrOpGenericAdaptorBase::GenericCastToPtrOpGenericAdaptorBase(GenericCastToPtrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail GenericCastToPtrOpAdaptor::GenericCastToPtrOpAdaptor(GenericCastToPtrOp op) : GenericCastToPtrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GenericCastToPtrOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult GenericCastToPtrOp::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 GenericCastToPtrOp::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 GenericCastToPtrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GenericCastToPtrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GenericCastToPtrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GenericCastToPtrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GenericCastToPtrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GenericCastToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer) { odsState.addOperands(pointer); odsState.addTypes(result); } GenericCastToPtrOp GenericCastToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GenericCastToPtrOp GenericCastToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer)); } void GenericCastToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { odsState.addOperands(pointer); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GenericCastToPtrOp GenericCastToPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GenericCastToPtrOp GenericCastToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer)); } void GenericCastToPtrOp::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); } GenericCastToPtrOp GenericCastToPtrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GenericCastToPtrOp GenericCastToPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GenericCastToPtrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GenericCastToPtrOp GenericCastToPtrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GenericCastToPtrOp GenericCastToPtrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GenericCastToPtrOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult GenericCastToPtrOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GenericCastToPtrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand pointerRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pointerOperands(&pointerRawOperand, 1); ::llvm::SMLoc pointerOperandsLoc; (void)pointerOperandsLoc; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); pointerOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(pointerRawOperand)) 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(); pointerRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(pointerOperands, pointerTypes, pointerOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GenericCastToPtrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPointer(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GenericCastToPtrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GenericCastToPtrOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GlobalVariableOp definitions //===----------------------------------------------------------------------===// namespace detail { GlobalVariableOpGenericAdaptorBase::GlobalVariableOpGenericAdaptorBase(GlobalVariableOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::Type GlobalVariableOpGenericAdaptorBase::getType() { auto attr = getTypeAttr(); return ::llvm::cast<::mlir::Type>(attr.getValue()); } ::llvm::StringRef GlobalVariableOpGenericAdaptorBase::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::std::optional< ::llvm::StringRef > GlobalVariableOpGenericAdaptorBase::getInitializer() { auto attr = getInitializerAttr(); return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); } ::std::optional GlobalVariableOpGenericAdaptorBase::getLocation() { auto attr = getLocationAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } ::std::optional GlobalVariableOpGenericAdaptorBase::getBinding() { auto attr = getBindingAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } ::std::optional GlobalVariableOpGenericAdaptorBase::getDescriptorSet() { auto attr = getDescriptorSetAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } ::std::optional< ::llvm::StringRef > GlobalVariableOpGenericAdaptorBase::getBuiltIn() { auto attr = getBuiltInAttr(); return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); } ::std::optional<::mlir::spirv::LinkageAttributesAttr> GlobalVariableOpGenericAdaptorBase::getLinkageAttributes() { auto attr = getLinkageAttributesAttr(); return attr ? ::std::optional<::mlir::spirv::LinkageAttributesAttr>(::llvm::cast<::mlir::spirv::LinkageAttributesAttr>(attr)) : (::std::nullopt); } } // namespace detail GlobalVariableOpAdaptor::GlobalVariableOpAdaptor(GlobalVariableOp op) : GlobalVariableOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GlobalVariableOpAdaptor::verify(::mlir::Location loc) { auto tblgen_binding = getProperties().binding; (void)tblgen_binding; auto tblgen_built_in = getProperties().built_in; (void)tblgen_built_in; auto tblgen_descriptor_set = getProperties().descriptor_set; (void)tblgen_descriptor_set; auto tblgen_initializer = getProperties().initializer; (void)tblgen_initializer; auto tblgen_linkage_attributes = getProperties().linkage_attributes; (void)tblgen_linkage_attributes; auto tblgen_location = getProperties().location; (void)tblgen_location; auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitError(loc, "'spirv.GlobalVariable' op requires attribute 'sym_name'"); auto tblgen_type = getProperties().type; (void)tblgen_type; if (!tblgen_type) return emitError(loc, "'spirv.GlobalVariable' op requires attribute 'type'"); if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) return emitError(loc, "'spirv.GlobalVariable' op attribute 'type' failed to satisfy constraint: any type attribute"); if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) return emitError(loc, "'spirv.GlobalVariable' op attribute 'sym_name' failed to satisfy constraint: string attribute"); if (tblgen_initializer && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_initializer)))) return emitError(loc, "'spirv.GlobalVariable' op attribute 'initializer' failed to satisfy constraint: flat symbol reference attribute"); if (tblgen_location && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_location))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_location).getType().isSignlessInteger(32))))) return emitError(loc, "'spirv.GlobalVariable' op attribute 'location' failed to satisfy constraint: 32-bit signless integer attribute"); if (tblgen_binding && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_binding))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_binding).getType().isSignlessInteger(32))))) return emitError(loc, "'spirv.GlobalVariable' op attribute 'binding' failed to satisfy constraint: 32-bit signless integer attribute"); if (tblgen_descriptor_set && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_descriptor_set))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_descriptor_set).getType().isSignlessInteger(32))))) return emitError(loc, "'spirv.GlobalVariable' op attribute 'descriptor_set' failed to satisfy constraint: 32-bit signless integer attribute"); if (tblgen_built_in && !((::llvm::isa<::mlir::StringAttr>(tblgen_built_in)))) return emitError(loc, "'spirv.GlobalVariable' op attribute 'built_in' failed to satisfy constraint: string attribute"); if (tblgen_linkage_attributes && !((::llvm::isa<::mlir::spirv::LinkageAttributesAttr>(tblgen_linkage_attributes)))) return emitError(loc, "'spirv.GlobalVariable' op attribute 'linkage_attributes' failed to satisfy constraint: "); return ::mlir::success(); } ::llvm::LogicalResult GlobalVariableOp::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.binding; auto attr = dict.get("binding"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `binding` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.built_in; auto attr = dict.get("built_in"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `built_in` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.descriptor_set; auto attr = dict.get("descriptor_set"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `descriptor_set` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.initializer; auto attr = dict.get("initializer"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `initializer` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.linkage_attributes; auto attr = dict.get("linkage_attributes"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `linkage_attributes` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.location; auto attr = dict.get("location"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `location` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto attr = dict.get("sym_name"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.type; auto attr = dict.get("type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `type` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GlobalVariableOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.binding; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("binding", propStorage)); } { const auto &propStorage = prop.built_in; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("built_in", propStorage)); } { const auto &propStorage = prop.descriptor_set; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("descriptor_set", propStorage)); } { const auto &propStorage = prop.initializer; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("initializer", propStorage)); } { const auto &propStorage = prop.linkage_attributes; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("linkage_attributes", propStorage)); } { const auto &propStorage = prop.location; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("location", propStorage)); } { const auto &propStorage = prop.sym_name; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("sym_name", propStorage)); } { const auto &propStorage = prop.type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("type", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GlobalVariableOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.binding.getAsOpaquePointer()), llvm::hash_value(prop.built_in.getAsOpaquePointer()), llvm::hash_value(prop.descriptor_set.getAsOpaquePointer()), llvm::hash_value(prop.initializer.getAsOpaquePointer()), llvm::hash_value(prop.linkage_attributes.getAsOpaquePointer()), llvm::hash_value(prop.location.getAsOpaquePointer()), llvm::hash_value(prop.sym_name.getAsOpaquePointer()), llvm::hash_value(prop.type.getAsOpaquePointer())); } std::optional GlobalVariableOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "binding") return prop.binding; if (name == "built_in") return prop.built_in; if (name == "descriptor_set") return prop.descriptor_set; if (name == "initializer") return prop.initializer; if (name == "linkage_attributes") return prop.linkage_attributes; if (name == "location") return prop.location; if (name == "sym_name") return prop.sym_name; if (name == "type") return prop.type; return std::nullopt; } void GlobalVariableOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "binding") { prop.binding = ::llvm::dyn_cast_or_null>(value); return; } if (name == "built_in") { prop.built_in = ::llvm::dyn_cast_or_null>(value); return; } if (name == "descriptor_set") { prop.descriptor_set = ::llvm::dyn_cast_or_null>(value); return; } if (name == "initializer") { prop.initializer = ::llvm::dyn_cast_or_null>(value); return; } if (name == "linkage_attributes") { prop.linkage_attributes = ::llvm::dyn_cast_or_null>(value); return; } if (name == "location") { prop.location = ::llvm::dyn_cast_or_null>(value); return; } if (name == "sym_name") { prop.sym_name = ::llvm::dyn_cast_or_null>(value); return; } if (name == "type") { prop.type = ::llvm::dyn_cast_or_null>(value); return; } } void GlobalVariableOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.binding) attrs.append("binding", prop.binding); if (prop.built_in) attrs.append("built_in", prop.built_in); if (prop.descriptor_set) attrs.append("descriptor_set", prop.descriptor_set); if (prop.initializer) attrs.append("initializer", prop.initializer); if (prop.linkage_attributes) attrs.append("linkage_attributes", prop.linkage_attributes); if (prop.location) attrs.append("location", prop.location); if (prop.sym_name) attrs.append("sym_name", prop.sym_name); if (prop.type) attrs.append("type", prop.type); } ::llvm::LogicalResult GlobalVariableOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getBindingAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(attr, "binding", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getBuiltInAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(attr, "built_in", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getDescriptorSetAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(attr, "descriptor_set", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getInitializerAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(attr, "initializer", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLinkageAttributesAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps18(attr, "linkage_attributes", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLocationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(attr, "location", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(attr, "sym_name", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps8(attr, "type", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GlobalVariableOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.binding))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.built_in))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.descriptor_set))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.initializer))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.linkage_attributes))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.location))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.sym_name))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.type))) return ::mlir::failure(); return ::mlir::success(); } void GlobalVariableOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.binding); writer.writeOptionalAttribute(prop.built_in); writer.writeOptionalAttribute(prop.descriptor_set); writer.writeOptionalAttribute(prop.initializer); writer.writeOptionalAttribute(prop.linkage_attributes); writer.writeOptionalAttribute(prop.location); writer.writeAttribute(prop.sym_name); writer.writeAttribute(prop.type); } ::mlir::Type GlobalVariableOp::getType() { auto attr = getTypeAttr(); return ::llvm::cast<::mlir::Type>(attr.getValue()); } ::llvm::StringRef GlobalVariableOp::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::std::optional< ::llvm::StringRef > GlobalVariableOp::getInitializer() { auto attr = getInitializerAttr(); return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); } ::std::optional GlobalVariableOp::getLocation() { auto attr = getLocationAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } ::std::optional GlobalVariableOp::getBinding() { auto attr = getBindingAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } ::std::optional GlobalVariableOp::getDescriptorSet() { auto attr = getDescriptorSetAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } ::std::optional< ::llvm::StringRef > GlobalVariableOp::getBuiltIn() { auto attr = getBuiltInAttr(); return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); } ::std::optional<::mlir::spirv::LinkageAttributesAttr> GlobalVariableOp::getLinkageAttributes() { auto attr = getLinkageAttributesAttr(); return attr ? ::std::optional<::mlir::spirv::LinkageAttributesAttr>(::llvm::cast<::mlir::spirv::LinkageAttributesAttr>(attr)) : (::std::nullopt); } void GlobalVariableOp::setType(::mlir::Type attrValue) { getProperties().type = ::mlir::TypeAttr::get(attrValue); } void GlobalVariableOp::setSymName(::llvm::StringRef attrValue) { getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue); } void GlobalVariableOp::setInitializer(::std::optional<::llvm::StringRef> attrValue) { auto &odsProp = getProperties().initializer; if (attrValue) odsProp = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void GlobalVariableOp::setLocation(::std::optional attrValue) { auto &odsProp = getProperties().location; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } void GlobalVariableOp::setBinding(::std::optional attrValue) { auto &odsProp = getProperties().binding; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } void GlobalVariableOp::setDescriptorSet(::std::optional attrValue) { auto &odsProp = getProperties().descriptor_set; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } void GlobalVariableOp::setBuiltIn(::std::optional<::llvm::StringRef> attrValue) { auto &odsProp = getProperties().built_in; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue); else odsProp = nullptr; } void GlobalVariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeAttr type, StringAttr sym_name, FlatSymbolRefAttr initializer) { odsState.addAttribute("type", type); odsState.addAttribute(getSymNameAttrName(odsState.name), sym_name); if (initializer) odsState.addAttribute(getInitializerAttrName(odsState.name), initializer); } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeAttr type, StringAttr sym_name, FlatSymbolRefAttr initializer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(sym_name), std::forward(initializer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, TypeAttr type, StringAttr sym_name, FlatSymbolRefAttr initializer) { return create(builder, builder.getLoc(), std::forward(type), std::forward(sym_name), std::forward(initializer)); } void GlobalVariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeAttr type, ArrayRef namedAttrs) { odsState.addAttribute("type", type); odsState.addAttributes(namedAttrs); } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeAttr type, ArrayRef namedAttrs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(namedAttrs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, TypeAttr type, ArrayRef namedAttrs) { return create(builder, builder.getLoc(), std::forward(type), std::forward(namedAttrs)); } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, StringRef name, unsigned descriptorSet, unsigned binding) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(name), std::forward(descriptorSet), std::forward(binding)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, StringRef name, unsigned descriptorSet, unsigned binding) { return create(builder, builder.getLoc(), std::forward(type), std::forward(name), std::forward(descriptorSet), std::forward(binding)); } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, StringRef name, spirv::BuiltIn builtin) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(name), std::forward(builtin)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, StringRef name, spirv::BuiltIn builtin) { return create(builder, builder.getLoc(), std::forward(type), std::forward(name), std::forward(builtin)); } void GlobalVariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, StringRef sym_name, FlatSymbolRefAttr initializer) { odsState.addAttribute("type", TypeAttr::get(type)); odsState.addAttribute(getSymNameAttrName(odsState.name), odsBuilder.getStringAttr(sym_name)); if (initializer) odsState.addAttribute(getInitializerAttrName(odsState.name), initializer); } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type type, StringRef sym_name, FlatSymbolRefAttr initializer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(sym_name), std::forward(initializer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, Type type, StringRef sym_name, FlatSymbolRefAttr initializer) { return create(builder, builder.getLoc(), std::forward(type), std::forward(sym_name), std::forward(initializer)); } void GlobalVariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { odsState.getOrAddProperties().type = type; odsState.getOrAddProperties().sym_name = sym_name; if (initializer) { odsState.getOrAddProperties().initializer = initializer; } if (location) { odsState.getOrAddProperties().location = location; } if (binding) { odsState.getOrAddProperties().binding = binding; } if (descriptor_set) { odsState.getOrAddProperties().descriptor_set = descriptor_set; } if (built_in) { odsState.getOrAddProperties().built_in = built_in; } if (linkage_attributes) { odsState.getOrAddProperties().linkage_attributes = linkage_attributes; } } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location_, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { ::mlir::OperationState __state__(location_, getOperationName()); build(builder, __state__, std::forward(type), std::forward(sym_name), std::forward(initializer), std::forward(location), std::forward(binding), std::forward(descriptor_set), std::forward(built_in), std::forward(linkage_attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { return create(builder, builder.getLoc(), std::forward(type), std::forward(sym_name), std::forward(initializer), std::forward(location), std::forward(binding), std::forward(descriptor_set), std::forward(built_in), std::forward(linkage_attributes)); } void GlobalVariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { odsState.getOrAddProperties().type = type; odsState.getOrAddProperties().sym_name = sym_name; if (initializer) { odsState.getOrAddProperties().initializer = initializer; } if (location) { odsState.getOrAddProperties().location = location; } if (binding) { odsState.getOrAddProperties().binding = binding; } if (descriptor_set) { odsState.getOrAddProperties().descriptor_set = descriptor_set; } if (built_in) { odsState.getOrAddProperties().built_in = built_in; } if (linkage_attributes) { odsState.getOrAddProperties().linkage_attributes = linkage_attributes; } assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location_, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { ::mlir::OperationState __state__(location_, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(initializer), std::forward(location), std::forward(binding), std::forward(descriptor_set), std::forward(built_in), std::forward(linkage_attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(initializer), std::forward(location), std::forward(binding), std::forward(descriptor_set), std::forward(built_in), std::forward(linkage_attributes)); } void GlobalVariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type type, ::llvm::StringRef sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); if (initializer) { odsState.getOrAddProperties().initializer = initializer; } if (location) { odsState.getOrAddProperties().location = location; } if (binding) { odsState.getOrAddProperties().binding = binding; } if (descriptor_set) { odsState.getOrAddProperties().descriptor_set = descriptor_set; } if (built_in) { odsState.getOrAddProperties().built_in = built_in; } if (linkage_attributes) { odsState.getOrAddProperties().linkage_attributes = linkage_attributes; } } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location_, ::mlir::Type type, ::llvm::StringRef sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { ::mlir::OperationState __state__(location_, getOperationName()); build(builder, __state__, std::forward(type), std::forward(sym_name), std::forward(initializer), std::forward(location), std::forward(binding), std::forward(descriptor_set), std::forward(built_in), std::forward(linkage_attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type type, ::llvm::StringRef sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { return create(builder, builder.getLoc(), std::forward(type), std::forward(sym_name), std::forward(initializer), std::forward(location), std::forward(binding), std::forward(descriptor_set), std::forward(built_in), std::forward(linkage_attributes)); } void GlobalVariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); if (initializer) { odsState.getOrAddProperties().initializer = initializer; } if (location) { odsState.getOrAddProperties().location = location; } if (binding) { odsState.getOrAddProperties().binding = binding; } if (descriptor_set) { odsState.getOrAddProperties().descriptor_set = descriptor_set; } if (built_in) { odsState.getOrAddProperties().built_in = built_in; } if (linkage_attributes) { odsState.getOrAddProperties().linkage_attributes = linkage_attributes; } assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } GlobalVariableOp GlobalVariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location_, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { ::mlir::OperationState __state__(location_, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(initializer), std::forward(location), std::forward(binding), std::forward(descriptor_set), std::forward(built_in), std::forward(linkage_attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, /*optional*/::mlir::FlatSymbolRefAttr initializer, /*optional*/::mlir::IntegerAttr location, /*optional*/::mlir::IntegerAttr binding, /*optional*/::mlir::IntegerAttr descriptor_set, /*optional*/::mlir::StringAttr built_in, /*optional*/::mlir::spirv::LinkageAttributesAttr linkage_attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(initializer), std::forward(location), std::forward(binding), std::forward(descriptor_set), std::forward(built_in), std::forward(linkage_attributes)); } void GlobalVariableOp::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(); ::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."); } } GlobalVariableOp GlobalVariableOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GlobalVariableOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GlobalVariableOp GlobalVariableOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GlobalVariableOp GlobalVariableOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GlobalVariableOp::verifyInvariantsImpl() { auto tblgen_binding = getProperties().binding; (void)tblgen_binding; auto tblgen_built_in = getProperties().built_in; (void)tblgen_built_in; auto tblgen_descriptor_set = getProperties().descriptor_set; (void)tblgen_descriptor_set; auto tblgen_initializer = getProperties().initializer; (void)tblgen_initializer; auto tblgen_linkage_attributes = getProperties().linkage_attributes; (void)tblgen_linkage_attributes; auto tblgen_location = getProperties().location; (void)tblgen_location; auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); auto tblgen_type = getProperties().type; (void)tblgen_type; if (!tblgen_type) return emitOpError("requires attribute 'type'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps8(*this, tblgen_type, "type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(*this, tblgen_sym_name, "sym_name"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(*this, tblgen_initializer, "initializer"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(*this, tblgen_location, "location"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(*this, tblgen_binding, "binding"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(*this, tblgen_descriptor_set, "descriptor_set"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(*this, tblgen_built_in, "built_in"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps18(*this, tblgen_linkage_attributes, "linkage_attributes"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult GlobalVariableOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GlobalVariableOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.type; auto typeAttrName = ::mlir::StringAttr::get(ctx, "type"); auto attr = dict.get(typeAttrName); usedKeys.insert(typeAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for type in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name"); auto attr = dict.get(sym_nameAttrName); usedKeys.insert(sym_nameAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for sym_name in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.initializer; auto initializerAttrName = ::mlir::StringAttr::get(ctx, "initializer"); auto attr = dict.get(initializerAttrName); usedKeys.insert(initializerAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for initializer in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `initializer` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.location; auto locationAttrName = ::mlir::StringAttr::get(ctx, "location"); auto attr = dict.get(locationAttrName); usedKeys.insert(locationAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for location in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `location` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.binding; auto bindingAttrName = ::mlir::StringAttr::get(ctx, "binding"); auto attr = dict.get(bindingAttrName); usedKeys.insert(bindingAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for binding in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `binding` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.descriptor_set; auto descriptor_setAttrName = ::mlir::StringAttr::get(ctx, "descriptor_set"); auto attr = dict.get(descriptor_setAttrName); usedKeys.insert(descriptor_setAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for descriptor_set in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `descriptor_set` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.built_in; auto built_inAttrName = ::mlir::StringAttr::get(ctx, "built_in"); auto attr = dict.get(built_inAttrName); usedKeys.insert(built_inAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for built_in in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `built_in` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.linkage_attributes; auto linkage_attributesAttrName = ::mlir::StringAttr::get(ctx, "linkage_attributes"); auto attr = dict.get(linkage_attributesAttrName); usedKeys.insert(linkage_attributesAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for linkage_attributes in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `linkage_attributes` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GlobalVariableOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GlobalVariableOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GraphARMOp definitions //===----------------------------------------------------------------------===// namespace detail { GraphARMOpGenericAdaptorBase::GraphARMOpGenericAdaptorBase(GraphARMOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::GraphType GraphARMOpGenericAdaptorBase::getFunctionType() { auto attr = getFunctionTypeAttr(); return ::llvm::cast<::mlir::GraphType>(attr.getValue()); } ::std::optional< ::mlir::ArrayAttr > GraphARMOpGenericAdaptorBase::getArgAttrs() { auto attr = getArgAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::std::optional< ::mlir::ArrayAttr > GraphARMOpGenericAdaptorBase::getResAttrs() { auto attr = getResAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::std::optional< bool > GraphARMOpGenericAdaptorBase::getEntryPoint() { auto attr = getEntryPointAttr(); return attr ? ::std::optional< bool >(attr.getValue()) : (::std::nullopt); } ::llvm::StringRef GraphARMOpGenericAdaptorBase::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } } // namespace detail GraphARMOpAdaptor::GraphARMOpAdaptor(GraphARMOp op) : GraphARMOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GraphARMOpAdaptor::verify(::mlir::Location loc) { auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; auto tblgen_entry_point = getProperties().entry_point; (void)tblgen_entry_point; auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; if (!tblgen_function_type) return emitError(loc, "'spirv.ARM.Graph' op requires attribute 'function_type'"); auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitError(loc, "'spirv.ARM.Graph' op requires attribute 'sym_name'"); if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::GraphType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::GraphType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) return emitError(loc, "'spirv.ARM.Graph' op attribute 'function_type' failed to satisfy constraint: type attribute of graph type"); if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) return emitError(loc, "'spirv.ARM.Graph' op attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) return emitError(loc, "'spirv.ARM.Graph' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); if (tblgen_entry_point && !((::llvm::isa<::mlir::BoolAttr>(tblgen_entry_point)))) return emitError(loc, "'spirv.ARM.Graph' op attribute 'entry_point' failed to satisfy constraint: bool attribute"); if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) return emitError(loc, "'spirv.ARM.Graph' op attribute 'sym_name' failed to satisfy constraint: string attribute"); return ::mlir::success(); } ::llvm::LogicalResult GraphARMOp::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.arg_attrs; auto attr = dict.get("arg_attrs"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.entry_point; auto attr = dict.get("entry_point"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `entry_point` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.function_type; auto attr = dict.get("function_type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `function_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.res_attrs; auto attr = dict.get("res_attrs"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto attr = dict.get("sym_name"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GraphARMOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.arg_attrs; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", propStorage)); } { const auto &propStorage = prop.entry_point; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("entry_point", propStorage)); } { const auto &propStorage = prop.function_type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("function_type", propStorage)); } { const auto &propStorage = prop.res_attrs; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("res_attrs", propStorage)); } { const auto &propStorage = prop.sym_name; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("sym_name", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GraphARMOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), llvm::hash_value(prop.entry_point.getAsOpaquePointer()), llvm::hash_value(prop.function_type.getAsOpaquePointer()), llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), llvm::hash_value(prop.sym_name.getAsOpaquePointer())); } std::optional GraphARMOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "arg_attrs") return prop.arg_attrs; if (name == "entry_point") return prop.entry_point; if (name == "function_type") return prop.function_type; if (name == "res_attrs") return prop.res_attrs; if (name == "sym_name") return prop.sym_name; return std::nullopt; } void GraphARMOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "arg_attrs") { prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); return; } if (name == "entry_point") { prop.entry_point = ::llvm::dyn_cast_or_null>(value); return; } if (name == "function_type") { prop.function_type = ::llvm::dyn_cast_or_null>(value); return; } if (name == "res_attrs") { prop.res_attrs = ::llvm::dyn_cast_or_null>(value); return; } if (name == "sym_name") { prop.sym_name = ::llvm::dyn_cast_or_null>(value); return; } } void GraphARMOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); if (prop.entry_point) attrs.append("entry_point", prop.entry_point); if (prop.function_type) attrs.append("function_type", prop.function_type); if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); if (prop.sym_name) attrs.append("sym_name", prop.sym_name); } ::llvm::LogicalResult GraphARMOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(attr, "arg_attrs", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getEntryPointAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps20(attr, "entry_point", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps19(attr, "function_type", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(attr, "res_attrs", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(attr, "sym_name", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GraphARMOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.entry_point))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.function_type))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.sym_name))) return ::mlir::failure(); return ::mlir::success(); } void GraphARMOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.arg_attrs); writer.writeOptionalAttribute(prop.entry_point); writer.writeAttribute(prop.function_type); writer.writeOptionalAttribute(prop.res_attrs); writer.writeAttribute(prop.sym_name); } ::mlir::GraphType GraphARMOp::getFunctionType() { auto attr = getFunctionTypeAttr(); return ::llvm::cast<::mlir::GraphType>(attr.getValue()); } ::std::optional< ::mlir::ArrayAttr > GraphARMOp::getArgAttrs() { auto attr = getArgAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::std::optional< ::mlir::ArrayAttr > GraphARMOp::getResAttrs() { auto attr = getResAttrsAttr(); return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); } ::std::optional< bool > GraphARMOp::getEntryPoint() { auto attr = getEntryPointAttr(); return attr ? ::std::optional< bool >(attr.getValue()) : (::std::nullopt); } ::llvm::StringRef GraphARMOp::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } void GraphARMOp::setFunctionType(::mlir::GraphType attrValue) { getProperties().function_type = ::mlir::TypeAttr::get(attrValue); } void GraphARMOp::setEntryPoint(::std::optional attrValue) { auto &odsProp = getProperties().entry_point; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getBoolAttr(*attrValue); else odsProp = nullptr; } void GraphARMOp::setSymName(::llvm::StringRef attrValue) { getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue); } GraphARMOp GraphARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef name, GraphType type, ArrayRef attrs, bool entry_point) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(name), std::forward(type), std::forward(attrs), std::forward(entry_point)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphARMOp GraphARMOp::create(::mlir::ImplicitLocOpBuilder &builder, StringRef name, GraphType type, ArrayRef attrs, bool entry_point) { return create(builder, builder.getLoc(), std::forward(name), std::forward(type), std::forward(attrs), std::forward(entry_point)); } void GraphARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::mlir::StringAttr sym_name) { odsState.getOrAddProperties().function_type = function_type; if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } if (entry_point) { odsState.getOrAddProperties().entry_point = entry_point; } odsState.getOrAddProperties().sym_name = sym_name; (void)odsState.addRegion(); } GraphARMOp GraphARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::mlir::StringAttr sym_name) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(entry_point), std::forward(sym_name)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphARMOp GraphARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::mlir::StringAttr sym_name) { return create(builder, builder.getLoc(), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(entry_point), std::forward(sym_name)); } void GraphARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::mlir::StringAttr sym_name) { odsState.getOrAddProperties().function_type = function_type; if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } if (entry_point) { odsState.getOrAddProperties().entry_point = entry_point; } odsState.getOrAddProperties().sym_name = sym_name; (void)odsState.addRegion(); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } GraphARMOp GraphARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::mlir::StringAttr sym_name) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(entry_point), std::forward(sym_name)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphARMOp GraphARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::mlir::StringAttr sym_name) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(entry_point), std::forward(sym_name)); } void GraphARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::GraphType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::llvm::StringRef sym_name) { odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } if (entry_point) { odsState.getOrAddProperties().entry_point = entry_point; } odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); (void)odsState.addRegion(); } GraphARMOp GraphARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::GraphType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::llvm::StringRef sym_name) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(entry_point), std::forward(sym_name)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphARMOp GraphARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::GraphType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::llvm::StringRef sym_name) { return create(builder, builder.getLoc(), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(entry_point), std::forward(sym_name)); } void GraphARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::GraphType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::llvm::StringRef sym_name) { odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); if (arg_attrs) { odsState.getOrAddProperties().arg_attrs = arg_attrs; } if (res_attrs) { odsState.getOrAddProperties().res_attrs = res_attrs; } if (entry_point) { odsState.getOrAddProperties().entry_point = entry_point; } odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); (void)odsState.addRegion(); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } GraphARMOp GraphARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::GraphType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::llvm::StringRef sym_name) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(entry_point), std::forward(sym_name)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphARMOp GraphARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::GraphType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::BoolAttr entry_point, ::llvm::StringRef sym_name) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(function_type), std::forward(arg_attrs), std::forward(res_attrs), std::forward(entry_point), std::forward(sym_name)); } void GraphARMOp::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); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } GraphARMOp GraphARMOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphARMOp GraphARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GraphARMOp::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)); odsState.addAttributes(discardableAttributes); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GraphARMOp GraphARMOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphARMOp GraphARMOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GraphARMOp::verifyInvariantsImpl() { auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; auto tblgen_entry_point = getProperties().entry_point; (void)tblgen_entry_point; auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps19(*this, tblgen_function_type, "function_type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(*this, tblgen_arg_attrs, "arg_attrs"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps16(*this, tblgen_res_attrs, "res_attrs"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps20(*this, tblgen_entry_point, "entry_point"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(*this, tblgen_sym_name, "sym_name"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); { unsigned index = 0; (void)index; for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) if (::mlir::failed(__mlir_ods_local_region_constraint_SPIRVOps1(*this, region, "body", index++))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GraphARMOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GraphARMOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.function_type; auto function_typeAttrName = ::mlir::StringAttr::get(ctx, "function_type"); auto attr = dict.get(function_typeAttrName); usedKeys.insert(function_typeAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for function_type in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `function_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.arg_attrs; auto arg_attrsAttrName = ::mlir::StringAttr::get(ctx, "arg_attrs"); auto attr = dict.get(arg_attrsAttrName); usedKeys.insert(arg_attrsAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.res_attrs; auto res_attrsAttrName = ::mlir::StringAttr::get(ctx, "res_attrs"); auto attr = dict.get(res_attrsAttrName); usedKeys.insert(res_attrsAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for res_attrs in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.entry_point; auto entry_pointAttrName = ::mlir::StringAttr::get(ctx, "entry_point"); auto attr = dict.get(entry_pointAttrName); usedKeys.insert(entry_pointAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for entry_point in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `entry_point` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name"); auto attr = dict.get(sym_nameAttrName); usedKeys.insert(sym_nameAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for sym_name in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GraphARMOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GraphARMOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GraphConstantARMOp definitions //===----------------------------------------------------------------------===// namespace detail { GraphConstantARMOpGenericAdaptorBase::GraphConstantARMOpGenericAdaptorBase(GraphConstantARMOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t GraphConstantARMOpGenericAdaptorBase::getGraphConstantId() { auto attr = getGraphConstantIdAttr(); return attr.getValue().getZExtValue(); } } // namespace detail GraphConstantARMOpAdaptor::GraphConstantARMOpAdaptor(GraphConstantARMOp op) : GraphConstantARMOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GraphConstantARMOpAdaptor::verify(::mlir::Location loc) { auto tblgen_graph_constant_id = getProperties().graph_constant_id; (void)tblgen_graph_constant_id; if (!tblgen_graph_constant_id) return emitError(loc, "'spirv.ARM.GraphConstant' op requires attribute 'graph_constant_id'"); if (tblgen_graph_constant_id && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_graph_constant_id))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_graph_constant_id).getType().isSignlessInteger(32))))) return emitError(loc, "'spirv.ARM.GraphConstant' op attribute 'graph_constant_id' failed to satisfy constraint: 32-bit signless integer attribute"); return ::mlir::success(); } ::llvm::LogicalResult GraphConstantARMOp::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.graph_constant_id; auto attr = dict.get("graph_constant_id"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `graph_constant_id` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GraphConstantARMOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.graph_constant_id; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("graph_constant_id", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GraphConstantARMOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.graph_constant_id.getAsOpaquePointer())); } std::optional GraphConstantARMOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "graph_constant_id") return prop.graph_constant_id; return std::nullopt; } void GraphConstantARMOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "graph_constant_id") { prop.graph_constant_id = ::llvm::dyn_cast_or_null>(value); return; } } void GraphConstantARMOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.graph_constant_id) attrs.append("graph_constant_id", prop.graph_constant_id); } ::llvm::LogicalResult GraphConstantARMOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getGraphConstantIdAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(attr, "graph_constant_id", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GraphConstantARMOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.graph_constant_id))) return ::mlir::failure(); return ::mlir::success(); } void GraphConstantARMOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.graph_constant_id); } uint32_t GraphConstantARMOp::getGraphConstantId() { auto attr = getGraphConstantIdAttr(); return attr.getValue().getZExtValue(); } void GraphConstantARMOp::setGraphConstantId(uint32_t attrValue) { getProperties().graph_constant_id = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void GraphConstantARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr graph_constant_id) { odsState.getOrAddProperties().graph_constant_id = graph_constant_id; odsState.addTypes(output); } GraphConstantARMOp GraphConstantARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr graph_constant_id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(graph_constant_id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphConstantARMOp GraphConstantARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr graph_constant_id) { return create(builder, builder.getLoc(), std::forward(output), std::forward(graph_constant_id)); } void GraphConstantARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr graph_constant_id) { odsState.getOrAddProperties().graph_constant_id = graph_constant_id; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GraphConstantARMOp GraphConstantARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr graph_constant_id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(graph_constant_id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphConstantARMOp GraphConstantARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr graph_constant_id) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(graph_constant_id)); } void GraphConstantARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t graph_constant_id) { odsState.getOrAddProperties().graph_constant_id = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), graph_constant_id); odsState.addTypes(output); } GraphConstantARMOp GraphConstantARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t graph_constant_id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(graph_constant_id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphConstantARMOp GraphConstantARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t graph_constant_id) { return create(builder, builder.getLoc(), std::forward(output), std::forward(graph_constant_id)); } void GraphConstantARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t graph_constant_id) { odsState.getOrAddProperties().graph_constant_id = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), graph_constant_id); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GraphConstantARMOp GraphConstantARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t graph_constant_id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(graph_constant_id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphConstantARMOp GraphConstantARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t graph_constant_id) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(graph_constant_id)); } void GraphConstantARMOp::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() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } GraphConstantARMOp GraphConstantARMOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphConstantARMOp GraphConstantARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GraphConstantARMOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GraphConstantARMOp GraphConstantARMOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphConstantARMOp GraphConstantARMOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GraphConstantARMOp::verifyInvariantsImpl() { auto tblgen_graph_constant_id = getProperties().graph_constant_id; (void)tblgen_graph_constant_id; if (!tblgen_graph_constant_id) return emitOpError("requires attribute 'graph_constant_id'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps14(*this, tblgen_graph_constant_id, "graph_constant_id"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps29(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult GraphConstantARMOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult GraphConstantARMOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::Type outputRawType{}; ::llvm::ArrayRef<::mlir::Type> outputTypes(&outputRawType, 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(); } if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); outputRawType = type; } result.addTypes(outputTypes); return ::mlir::success(); } void GraphConstantARMOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOutput().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GraphConstantARMOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GraphConstantARMOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GraphConstantARMOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GraphEntryPointARMOp definitions //===----------------------------------------------------------------------===// namespace detail { GraphEntryPointARMOpGenericAdaptorBase::GraphEntryPointARMOpGenericAdaptorBase(GraphEntryPointARMOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::llvm::StringRef GraphEntryPointARMOpGenericAdaptorBase::getFn() { auto attr = getFnAttr(); return attr.getValue(); } ::mlir::ArrayAttr GraphEntryPointARMOpGenericAdaptorBase::getInterface() { auto attr = getInterfaceAttr(); return attr; } } // namespace detail GraphEntryPointARMOpAdaptor::GraphEntryPointARMOpAdaptor(GraphEntryPointARMOp op) : GraphEntryPointARMOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GraphEntryPointARMOpAdaptor::verify(::mlir::Location loc) { auto tblgen_fn = getProperties().fn; (void)tblgen_fn; if (!tblgen_fn) return emitError(loc, "'spirv.ARM.GraphEntryPoint' op requires attribute 'fn'"); auto tblgen_interface = getProperties().interface; (void)tblgen_interface; if (!tblgen_interface) return emitError(loc, "'spirv.ARM.GraphEntryPoint' op requires attribute 'interface'"); if (tblgen_fn && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_fn)))) return emitError(loc, "'spirv.ARM.GraphEntryPoint' op attribute 'fn' failed to satisfy constraint: flat symbol reference attribute"); if (tblgen_interface && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_interface))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_interface), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) return emitError(loc, "'spirv.ARM.GraphEntryPoint' op attribute 'interface' failed to satisfy constraint: symbol ref array attribute"); return ::mlir::success(); } ::llvm::LogicalResult GraphEntryPointARMOp::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.fn; auto attr = dict.get("fn"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `fn` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.interface; auto attr = dict.get("interface"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `interface` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GraphEntryPointARMOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.fn; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("fn", propStorage)); } { const auto &propStorage = prop.interface; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("interface", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GraphEntryPointARMOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.fn.getAsOpaquePointer()), llvm::hash_value(prop.interface.getAsOpaquePointer())); } std::optional GraphEntryPointARMOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "fn") return prop.fn; if (name == "interface") return prop.interface; return std::nullopt; } void GraphEntryPointARMOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "fn") { prop.fn = ::llvm::dyn_cast_or_null>(value); return; } if (name == "interface") { prop.interface = ::llvm::dyn_cast_or_null>(value); return; } } void GraphEntryPointARMOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.fn) attrs.append("fn", prop.fn); if (prop.interface) attrs.append("interface", prop.interface); } ::llvm::LogicalResult GraphEntryPointARMOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getFnAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(attr, "fn", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getInterfaceAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps12(attr, "interface", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GraphEntryPointARMOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.fn))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.interface))) return ::mlir::failure(); return ::mlir::success(); } void GraphEntryPointARMOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.fn); writer.writeAttribute(prop.interface); } ::llvm::StringRef GraphEntryPointARMOp::getFn() { auto attr = getFnAttr(); return attr.getValue(); } ::mlir::ArrayAttr GraphEntryPointARMOp::getInterface() { auto attr = getInterfaceAttr(); return attr; } void GraphEntryPointARMOp::setFn(::llvm::StringRef attrValue) { getProperties().fn = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, spirv::GraphARMOp graph, ArrayRef interfaceVars) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(graph), std::forward(interfaceVars)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::ImplicitLocOpBuilder &builder, spirv::GraphARMOp graph, ArrayRef interfaceVars) { return create(builder, builder.getLoc(), std::forward(graph), std::forward(interfaceVars)); } void GraphEntryPointARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { odsState.getOrAddProperties().fn = fn; odsState.getOrAddProperties().interface = interface; } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(fn), std::forward(interface)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { return create(builder, builder.getLoc(), std::forward(fn), std::forward(interface)); } void GraphEntryPointARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { odsState.getOrAddProperties().fn = fn; odsState.getOrAddProperties().interface = interface; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(fn), std::forward(interface)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr fn, ::mlir::ArrayAttr interface) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(fn), std::forward(interface)); } void GraphEntryPointARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { odsState.getOrAddProperties().fn = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), fn); odsState.getOrAddProperties().interface = interface; } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(fn), std::forward(interface)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { return create(builder, builder.getLoc(), std::forward(fn), std::forward(interface)); } void GraphEntryPointARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { odsState.getOrAddProperties().fn = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), fn); odsState.getOrAddProperties().interface = interface; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(fn), std::forward(interface)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef fn, ::mlir::ArrayAttr interface) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(fn), std::forward(interface)); } void GraphEntryPointARMOp::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(); ::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."); } } GraphEntryPointARMOp GraphEntryPointARMOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphEntryPointARMOp GraphEntryPointARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GraphEntryPointARMOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GraphEntryPointARMOp GraphEntryPointARMOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphEntryPointARMOp GraphEntryPointARMOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GraphEntryPointARMOp::verifyInvariantsImpl() { auto tblgen_fn = getProperties().fn; (void)tblgen_fn; if (!tblgen_fn) return emitOpError("requires attribute 'fn'"); auto tblgen_interface = getProperties().interface; (void)tblgen_interface; if (!tblgen_interface) return emitOpError("requires attribute 'interface'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(*this, tblgen_fn, "fn"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps12(*this, tblgen_interface, "interface"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult GraphEntryPointARMOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GraphEntryPointARMOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.fn; auto fnAttrName = ::mlir::StringAttr::get(ctx, "fn"); auto attr = dict.get(fnAttrName); usedKeys.insert(fnAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for fn in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `fn` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.interface; auto interfaceAttrName = ::mlir::StringAttr::get(ctx, "interface"); auto attr = dict.get(interfaceAttrName); usedKeys.insert(interfaceAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for interface in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `interface` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GraphEntryPointARMOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GraphEntryPointARMOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GraphOutputsARMOp definitions //===----------------------------------------------------------------------===// namespace detail { GraphOutputsARMOpGenericAdaptorBase::GraphOutputsARMOpGenericAdaptorBase(GraphOutputsARMOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GraphOutputsARMOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {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 - 0) / 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 GraphOutputsARMOpAdaptor::GraphOutputsARMOpAdaptor(GraphOutputsARMOp op) : GraphOutputsARMOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GraphOutputsARMOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair GraphOutputsARMOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {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() - 0) / 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 GraphOutputsARMOp::getValueMutable() { auto range = getODSOperandIndexAndLength(0); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GraphOutputsARMOp::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 GraphOutputsARMOp::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 GraphOutputsARMOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional GraphOutputsARMOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void GraphOutputsARMOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void GraphOutputsARMOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult GraphOutputsARMOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void GraphOutputsARMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange value) { odsState.addOperands(value); } GraphOutputsARMOp GraphOutputsARMOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphOutputsARMOp GraphOutputsARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange value) { return create(builder, builder.getLoc(), std::forward(value)); } void GraphOutputsARMOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { odsState.addOperands(operands); odsState.addAttributes(attributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GraphOutputsARMOp GraphOutputsARMOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphOutputsARMOp GraphOutputsARMOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GraphOutputsARMOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { odsState.addOperands(operands); odsState.useProperties(const_cast(properties)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GraphOutputsARMOp GraphOutputsARMOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GraphOutputsARMOp GraphOutputsARMOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GraphOutputsARMOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps30(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult GraphOutputsARMOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GraphOutputsARMOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> valueOperands; ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> valueTypes; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(valueOperands)) 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.parseTypeList(valueTypes)) return ::mlir::failure(); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GraphOutputsARMOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getValue(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getValue().getTypes(); } void GraphOutputsARMOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GraphOutputsARMOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupBroadcastOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupBroadcastOpGenericAdaptorBase::GroupBroadcastOpGenericAdaptorBase(GroupBroadcastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupBroadcastOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupBroadcastOpAdaptor::GroupBroadcastOpAdaptor(GroupBroadcastOp op) : GroupBroadcastOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupBroadcastOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupBroadcast' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupBroadcast' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupBroadcastOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupBroadcastOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupBroadcastOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupBroadcastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupBroadcastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupBroadcastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupBroadcastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupBroadcastOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupBroadcastOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupBroadcastOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupBroadcastOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { odsState.addOperands(value); odsState.addOperands(localid); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupBroadcastOp GroupBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(localid)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(localid)); } void GroupBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { odsState.addOperands(value); odsState.addOperands(localid); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupBroadcastOp::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); } GroupBroadcastOp GroupBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(localid)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(localid)); } void GroupBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { odsState.addOperands(value); odsState.addOperands(localid); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupBroadcastOp GroupBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(localid)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value localid) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(localid)); } void GroupBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { odsState.addOperands(value); odsState.addOperands(localid); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupBroadcastOp GroupBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(localid)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(localid)); } void GroupBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { odsState.addOperands(value); odsState.addOperands(localid); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupBroadcastOp::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); } GroupBroadcastOp GroupBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(localid)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(localid)); } void GroupBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { odsState.addOperands(value); odsState.addOperands(localid); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupBroadcastOp GroupBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(localid)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value localid) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(localid)); } void GroupBroadcastOp::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(); ::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."); } } GroupBroadcastOp GroupBroadcastOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupBroadcastOp::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(); ::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(GroupBroadcastOp::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)."); } } GroupBroadcastOp GroupBroadcastOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupBroadcastOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupBroadcastOp GroupBroadcastOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupBroadcastOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupBroadcastOp::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)."); } } GroupBroadcastOp GroupBroadcastOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupBroadcastOp GroupBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupBroadcastOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps31(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {value, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupBroadcastOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GroupBroadcastOp::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 GroupBroadcastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type localidRawType{}; ::llvm::ArrayRef<::mlir::Type> localidTypes(&localidRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); localidRawType = type; } result.addTypes(valueTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(valueTypes), ::llvm::ArrayRef<::mlir::Type>(localidTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupBroadcastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _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 = getLocalid().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupBroadcastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupBroadcastOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupBroadcastOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupFAddOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupFAddOpGenericAdaptorBase::GroupFAddOpGenericAdaptorBase(GroupFAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupFAddOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupFAddOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupFAddOpAdaptor::GroupFAddOpAdaptor(GroupFAddOp op) : GroupFAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupFAddOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupFAdd' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupFAdd' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupFAdd' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupFAdd' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupFAddOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupFAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupFAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupFAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupFAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupFAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupFAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupFAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupFAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupFAddOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupFAddOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupFAddOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupFAddOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupFAddOp GroupFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFAddOp::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); } GroupFAddOp GroupFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupFAddOp GroupFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupFAddOp GroupFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFAddOp::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); } GroupFAddOp GroupFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupFAddOp GroupFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFAddOp::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(); ::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."); } } GroupFAddOp GroupFAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupFAddOp::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(); ::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(GroupFAddOp::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)."); } } GroupFAddOp GroupFAddOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupFAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupFAddOp GroupFAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupFAddOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFAddOp::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)."); } } GroupFAddOp GroupFAddOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFAddOp GroupFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupFAddOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupFAddOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupFAddOp::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 GroupFAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupFAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupFAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupFAddOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupFAddOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupFMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupFMaxOpGenericAdaptorBase::GroupFMaxOpGenericAdaptorBase(GroupFMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupFMaxOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupFMaxOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupFMaxOpAdaptor::GroupFMaxOpAdaptor(GroupFMaxOp op) : GroupFMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupFMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupFMax' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupFMax' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupFMax' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupFMax' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupFMaxOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupFMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupFMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupFMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupFMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupFMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupFMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupFMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupFMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupFMaxOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupFMaxOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupFMaxOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupFMaxOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupFMaxOp GroupFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMaxOp::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); } GroupFMaxOp GroupFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupFMaxOp GroupFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupFMaxOp GroupFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMaxOp::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); } GroupFMaxOp GroupFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupFMaxOp GroupFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMaxOp::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(); ::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."); } } GroupFMaxOp GroupFMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupFMaxOp::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(); ::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(GroupFMaxOp::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)."); } } GroupFMaxOp GroupFMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupFMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupFMaxOp GroupFMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupFMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMaxOp::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)."); } } GroupFMaxOp GroupFMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMaxOp GroupFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupFMaxOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupFMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupFMaxOp::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 GroupFMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupFMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupFMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupFMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupFMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupFMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupFMinOpGenericAdaptorBase::GroupFMinOpGenericAdaptorBase(GroupFMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupFMinOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupFMinOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupFMinOpAdaptor::GroupFMinOpAdaptor(GroupFMinOp op) : GroupFMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupFMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupFMin' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupFMin' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupFMin' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupFMin' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupFMinOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupFMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupFMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupFMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupFMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupFMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupFMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupFMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupFMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupFMinOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupFMinOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupFMinOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupFMinOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupFMinOp GroupFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMinOp::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); } GroupFMinOp GroupFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupFMinOp GroupFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupFMinOp GroupFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMinOp::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); } GroupFMinOp GroupFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupFMinOp GroupFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMinOp::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(); ::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."); } } GroupFMinOp GroupFMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupFMinOp::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(); ::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(GroupFMinOp::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)."); } } GroupFMinOp GroupFMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupFMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupFMinOp GroupFMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupFMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMinOp::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)."); } } GroupFMinOp GroupFMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMinOp GroupFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupFMinOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupFMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupFMinOp::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 GroupFMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupFMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupFMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupFMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupFMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupFMulKHROp definitions //===----------------------------------------------------------------------===// namespace detail { GroupFMulKHROpGenericAdaptorBase::GroupFMulKHROpGenericAdaptorBase(GroupFMulKHROp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupFMulKHROpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupFMulKHROpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupFMulKHROpAdaptor::GroupFMulKHROpAdaptor(GroupFMulKHROp op) : GroupFMulKHROpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupFMulKHROpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.KHR.GroupFMul' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.KHR.GroupFMul' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.KHR.GroupFMul' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.KHR.GroupFMul' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupFMulKHROp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupFMulKHROp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupFMulKHROp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupFMulKHROp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupFMulKHROp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupFMulKHROp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupFMulKHROp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupFMulKHROp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupFMulKHROp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupFMulKHROp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupFMulKHROp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupFMulKHROp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupFMulKHROp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupFMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupFMulKHROp GroupFMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMulKHROp::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); } GroupFMulKHROp GroupFMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupFMulKHROp GroupFMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupFMulKHROp GroupFMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMulKHROp::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); } GroupFMulKHROp GroupFMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupFMulKHROp GroupFMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupFMulKHROp::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(); ::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."); } } GroupFMulKHROp GroupFMulKHROp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupFMulKHROp::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(); ::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(GroupFMulKHROp::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)."); } } GroupFMulKHROp GroupFMulKHROp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupFMulKHROp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupFMulKHROp GroupFMulKHROp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupFMulKHROp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupFMulKHROp::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)."); } } GroupFMulKHROp GroupFMulKHROp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupFMulKHROp GroupFMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupFMulKHROp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupFMulKHROp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupFMulKHROp::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 GroupFMulKHROp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupFMulKHROp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupFMulKHROp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupFMulKHROp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupFMulKHROpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupIAddOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupIAddOpGenericAdaptorBase::GroupIAddOpGenericAdaptorBase(GroupIAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupIAddOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupIAddOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupIAddOpAdaptor::GroupIAddOpAdaptor(GroupIAddOp op) : GroupIAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupIAddOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupIAdd' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupIAdd' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupIAdd' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupIAdd' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupIAddOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupIAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupIAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupIAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupIAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupIAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupIAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupIAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupIAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupIAddOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupIAddOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupIAddOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupIAddOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupIAddOp GroupIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupIAddOp::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); } GroupIAddOp GroupIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupIAddOp GroupIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupIAddOp GroupIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupIAddOp::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); } GroupIAddOp GroupIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupIAddOp GroupIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIAddOp::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(); ::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."); } } GroupIAddOp GroupIAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupIAddOp::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(); ::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(GroupIAddOp::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)."); } } GroupIAddOp GroupIAddOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupIAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupIAddOp GroupIAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupIAddOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupIAddOp::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)."); } } GroupIAddOp GroupIAddOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIAddOp GroupIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupIAddOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupIAddOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupIAddOp::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 GroupIAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupIAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupIAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupIAddOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupIAddOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupIMulKHROp definitions //===----------------------------------------------------------------------===// namespace detail { GroupIMulKHROpGenericAdaptorBase::GroupIMulKHROpGenericAdaptorBase(GroupIMulKHROp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupIMulKHROpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupIMulKHROpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupIMulKHROpAdaptor::GroupIMulKHROpAdaptor(GroupIMulKHROp op) : GroupIMulKHROpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupIMulKHROpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.KHR.GroupIMul' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.KHR.GroupIMul' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.KHR.GroupIMul' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.KHR.GroupIMul' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupIMulKHROp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupIMulKHROp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupIMulKHROp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupIMulKHROp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupIMulKHROp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupIMulKHROp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupIMulKHROp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupIMulKHROp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupIMulKHROp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupIMulKHROp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupIMulKHROp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupIMulKHROp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupIMulKHROp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupIMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupIMulKHROp GroupIMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupIMulKHROp::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); } GroupIMulKHROp GroupIMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupIMulKHROp GroupIMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupIMulKHROp GroupIMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupIMulKHROp::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); } GroupIMulKHROp GroupIMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIMulKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupIMulKHROp GroupIMulKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupIMulKHROp::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(); ::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."); } } GroupIMulKHROp GroupIMulKHROp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupIMulKHROp::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(); ::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(GroupIMulKHROp::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)."); } } GroupIMulKHROp GroupIMulKHROp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupIMulKHROp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupIMulKHROp GroupIMulKHROp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupIMulKHROp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupIMulKHROp::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)."); } } GroupIMulKHROp GroupIMulKHROp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupIMulKHROp GroupIMulKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupIMulKHROp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupIMulKHROp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupIMulKHROp::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 GroupIMulKHROp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupIMulKHROp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupIMulKHROp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupIMulKHROp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupIMulKHROpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformAllEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformAllEqualOpGenericAdaptorBase::GroupNonUniformAllEqualOpGenericAdaptorBase(GroupNonUniformAllEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformAllEqualOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformAllEqualOpAdaptor::GroupNonUniformAllEqualOpAdaptor(GroupNonUniformAllEqualOp op) : GroupNonUniformAllEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformAllEqualOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformAllEqual' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformAllEqual' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAllEqualOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformAllEqualOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformAllEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformAllEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformAllEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformAllEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformAllEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAllEqualOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformAllEqualOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformAllEqualOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformAllEqualOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformAllEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformAllEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAllEqualOp::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); } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformAllEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformAllEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformAllEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAllEqualOp::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); } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformAllEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformAllEqualOp::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(); ::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."); } } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformAllEqualOp::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(); ::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(GroupNonUniformAllEqualOp::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)."); } } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformAllEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformAllEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAllEqualOp::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)."); } } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllEqualOp GroupNonUniformAllEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformAllEqualOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*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_SPIRVOps4(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAllEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupNonUniformAllEqualOp::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 GroupNonUniformAllEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformAllEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _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 = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformAllEqualOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformAllEqualOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformAllOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformAllOpGenericAdaptorBase::GroupNonUniformAllOpGenericAdaptorBase(GroupNonUniformAllOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformAllOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformAllOpAdaptor::GroupNonUniformAllOpAdaptor(GroupNonUniformAllOp op) : GroupNonUniformAllOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformAllOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformAll' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformAll' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAllOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformAllOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformAllOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformAllOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformAllOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformAllOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformAllOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAllOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformAllOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformAllOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformAllOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAllOp::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); } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAllOp::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); } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAllOp::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(); ::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."); } } GroupNonUniformAllOp GroupNonUniformAllOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformAllOp::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(); ::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(GroupNonUniformAllOp::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)."); } } GroupNonUniformAllOp GroupNonUniformAllOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformAllOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformAllOp GroupNonUniformAllOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformAllOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAllOp::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)."); } } GroupNonUniformAllOp GroupNonUniformAllOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAllOp GroupNonUniformAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformAllOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps4(*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_SPIRVOps4(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAllOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupNonUniformAllOp::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 GroupNonUniformAllOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::OpAsmParser::UnresolvedOperand predicateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> predicateOperands(&predicateRawOperand, 1); ::llvm::SMLoc predicateOperandsLoc; (void)predicateOperandsLoc; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; predicateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(predicateRawOperand)) 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::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); result.addTypes(resultTypes); if (parser.resolveOperands(predicateOperands, odsBuildableType0, predicateOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformAllOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getPredicate(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformAllOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformAllOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformAnyOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformAnyOpGenericAdaptorBase::GroupNonUniformAnyOpGenericAdaptorBase(GroupNonUniformAnyOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformAnyOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformAnyOpAdaptor::GroupNonUniformAnyOpAdaptor(GroupNonUniformAnyOp op) : GroupNonUniformAnyOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformAnyOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformAny' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformAny' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAnyOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformAnyOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformAnyOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformAnyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformAnyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformAnyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformAnyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAnyOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformAnyOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformAnyOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformAnyOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAnyOp::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); } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAnyOp::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); } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformAnyOp::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(); ::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."); } } GroupNonUniformAnyOp GroupNonUniformAnyOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformAnyOp::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(); ::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(GroupNonUniformAnyOp::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)."); } } GroupNonUniformAnyOp GroupNonUniformAnyOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformAnyOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformAnyOp GroupNonUniformAnyOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformAnyOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformAnyOp::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)."); } } GroupNonUniformAnyOp GroupNonUniformAnyOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformAnyOp GroupNonUniformAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformAnyOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps4(*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_SPIRVOps4(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformAnyOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupNonUniformAnyOp::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 GroupNonUniformAnyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::OpAsmParser::UnresolvedOperand predicateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> predicateOperands(&predicateRawOperand, 1); ::llvm::SMLoc predicateOperandsLoc; (void)predicateOperandsLoc; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; predicateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(predicateRawOperand)) 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::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); result.addTypes(resultTypes); if (parser.resolveOperands(predicateOperands, odsBuildableType0, predicateOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformAnyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getPredicate(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformAnyOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformAnyOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBallotBitCountOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBallotBitCountOpGenericAdaptorBase::GroupNonUniformBallotBitCountOpGenericAdaptorBase(GroupNonUniformBallotBitCountOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformBallotBitCountOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformBallotBitCountOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBallotBitCountOpAdaptor::GroupNonUniformBallotBitCountOpAdaptor(GroupNonUniformBallotBitCountOp op) : GroupNonUniformBallotBitCountOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBallotBitCountOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBallotBitCount' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformBallotBitCount' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBallotBitCount' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformBallotBitCount' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotBitCountOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBallotBitCountOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBallotBitCountOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformBallotBitCountOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformBallotBitCountOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBallotBitCountOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformBallotBitCountOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotBitCountOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBallotBitCountOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformBallotBitCountOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformBallotBitCountOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformBallotBitCountOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBallotBitCountOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBallotBitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value)); } void GroupNonUniformBallotBitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value)); } void GroupNonUniformBallotBitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value)); } void GroupNonUniformBallotBitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value)); } void GroupNonUniformBallotBitCountOp::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(); ::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."); } } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBallotBitCountOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotBitCountOp GroupNonUniformBallotBitCountOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBallotBitCountOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps32(*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_SPIRVOps33(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotBitCountOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult GroupNonUniformBallotBitCountOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) 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(); valueRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBallotBitCountOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(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; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBallotBitCountOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBallotBitCountOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBallotFindLSBOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBallotFindLSBOpGenericAdaptorBase::GroupNonUniformBallotFindLSBOpGenericAdaptorBase(GroupNonUniformBallotFindLSBOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformBallotFindLSBOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBallotFindLSBOpAdaptor::GroupNonUniformBallotFindLSBOpAdaptor(GroupNonUniformBallotFindLSBOp op) : GroupNonUniformBallotFindLSBOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBallotFindLSBOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBallotFindLSB' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBallotFindLSB' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotFindLSBOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBallotFindLSBOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBallotFindLSBOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformBallotFindLSBOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformBallotFindLSBOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBallotFindLSBOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformBallotFindLSBOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotFindLSBOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBallotFindLSBOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformBallotFindLSBOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformBallotFindLSBOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBallotFindLSBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBallotFindLSBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBallotFindLSBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBallotFindLSBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBallotFindLSBOp::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(); ::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."); } } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBallotFindLSBOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindLSBOp GroupNonUniformBallotFindLSBOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBallotFindLSBOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps34(*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_SPIRVOps33(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotFindLSBOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult GroupNonUniformBallotFindLSBOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBallotFindLSBOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(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; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBallotFindLSBOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBallotFindLSBOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBallotFindMSBOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBallotFindMSBOpGenericAdaptorBase::GroupNonUniformBallotFindMSBOpGenericAdaptorBase(GroupNonUniformBallotFindMSBOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformBallotFindMSBOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBallotFindMSBOpAdaptor::GroupNonUniformBallotFindMSBOpAdaptor(GroupNonUniformBallotFindMSBOp op) : GroupNonUniformBallotFindMSBOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBallotFindMSBOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBallotFindMSB' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBallotFindMSB' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotFindMSBOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBallotFindMSBOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBallotFindMSBOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformBallotFindMSBOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformBallotFindMSBOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBallotFindMSBOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformBallotFindMSBOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotFindMSBOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBallotFindMSBOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformBallotFindMSBOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformBallotFindMSBOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBallotFindMSBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBallotFindMSBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBallotFindMSBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBallotFindMSBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBallotFindMSBOp::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(); ::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."); } } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBallotFindMSBOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotFindMSBOp GroupNonUniformBallotFindMSBOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBallotFindMSBOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps34(*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_SPIRVOps33(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotFindMSBOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult GroupNonUniformBallotFindMSBOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBallotFindMSBOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(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; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBallotFindMSBOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBallotFindMSBOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBallotOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBallotOpGenericAdaptorBase::GroupNonUniformBallotOpGenericAdaptorBase(GroupNonUniformBallotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformBallotOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBallotOpAdaptor::GroupNonUniformBallotOpAdaptor(GroupNonUniformBallotOp op) : GroupNonUniformBallotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBallotOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBallot' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBallot' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBallotOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBallotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformBallotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformBallotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBallotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformBallotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBallotOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformBallotOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformBallotOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBallotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformBallotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformBallotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformBallotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(predicate)); } void GroupNonUniformBallotOp::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(); ::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."); } } GroupNonUniformBallotOp GroupNonUniformBallotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotOp GroupNonUniformBallotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBallotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBallotOp GroupNonUniformBallotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBallotOp GroupNonUniformBallotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBallotOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps4(*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_SPIRVOps34(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBallotOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult GroupNonUniformBallotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::OpAsmParser::UnresolvedOperand predicateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> predicateOperands(&predicateRawOperand, 1); ::llvm::SMLoc predicateOperandsLoc; (void)predicateOperandsLoc; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; predicateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(predicateRawOperand)) 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(); resultRawType = type; } ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); result.addTypes(resultTypes); if (parser.resolveOperands(predicateOperands, odsBuildableType0, predicateOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBallotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getPredicate(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBallotOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBallotOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBitwiseAndOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBitwiseAndOpGenericAdaptorBase::GroupNonUniformBitwiseAndOpGenericAdaptorBase(GroupNonUniformBitwiseAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformBitwiseAndOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformBitwiseAndOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformBitwiseAndOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBitwiseAndOpAdaptor::GroupNonUniformBitwiseAndOpAdaptor(GroupNonUniformBitwiseAndOp op) : GroupNonUniformBitwiseAndOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBitwiseAndOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBitwiseAnd' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformBitwiseAnd' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBitwiseAnd' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformBitwiseAnd' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformBitwiseAndOp::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 GroupNonUniformBitwiseAndOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformBitwiseAndOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBitwiseAndOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBitwiseAndOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformBitwiseAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformBitwiseAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBitwiseAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformBitwiseAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBitwiseAndOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBitwiseAndOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformBitwiseAndOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformBitwiseAndOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformBitwiseAndOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBitwiseAndOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseAndOp::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(); ::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."); } } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBitwiseAndOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseAndOp GroupNonUniformBitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBitwiseAndOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBitwiseAndOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformBitwiseAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformBitwiseAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBitwiseAndOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBitwiseAndOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBitwiseOrOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBitwiseOrOpGenericAdaptorBase::GroupNonUniformBitwiseOrOpGenericAdaptorBase(GroupNonUniformBitwiseOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformBitwiseOrOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformBitwiseOrOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformBitwiseOrOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBitwiseOrOpAdaptor::GroupNonUniformBitwiseOrOpAdaptor(GroupNonUniformBitwiseOrOp op) : GroupNonUniformBitwiseOrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBitwiseOrOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBitwiseOr' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformBitwiseOr' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBitwiseOr' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformBitwiseOr' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformBitwiseOrOp::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 GroupNonUniformBitwiseOrOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformBitwiseOrOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBitwiseOrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBitwiseOrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformBitwiseOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformBitwiseOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBitwiseOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformBitwiseOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBitwiseOrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBitwiseOrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformBitwiseOrOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformBitwiseOrOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformBitwiseOrOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBitwiseOrOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseOrOp::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(); ::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."); } } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBitwiseOrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseOrOp GroupNonUniformBitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBitwiseOrOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBitwiseOrOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformBitwiseOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformBitwiseOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBitwiseOrOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBitwiseOrOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBitwiseXorOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBitwiseXorOpGenericAdaptorBase::GroupNonUniformBitwiseXorOpGenericAdaptorBase(GroupNonUniformBitwiseXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformBitwiseXorOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformBitwiseXorOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformBitwiseXorOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBitwiseXorOpAdaptor::GroupNonUniformBitwiseXorOpAdaptor(GroupNonUniformBitwiseXorOp op) : GroupNonUniformBitwiseXorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBitwiseXorOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBitwiseXor' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformBitwiseXor' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBitwiseXor' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformBitwiseXor' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformBitwiseXorOp::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 GroupNonUniformBitwiseXorOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformBitwiseXorOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBitwiseXorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBitwiseXorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformBitwiseXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformBitwiseXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBitwiseXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformBitwiseXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBitwiseXorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBitwiseXorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformBitwiseXorOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformBitwiseXorOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformBitwiseXorOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBitwiseXorOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformBitwiseXorOp::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(); ::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."); } } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBitwiseXorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBitwiseXorOp GroupNonUniformBitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBitwiseXorOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBitwiseXorOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformBitwiseXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformBitwiseXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBitwiseXorOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBitwiseXorOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBroadcastFirstOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBroadcastFirstOpGenericAdaptorBase::GroupNonUniformBroadcastFirstOpGenericAdaptorBase(GroupNonUniformBroadcastFirstOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformBroadcastFirstOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBroadcastFirstOpAdaptor::GroupNonUniformBroadcastFirstOpAdaptor(GroupNonUniformBroadcastFirstOp op) : GroupNonUniformBroadcastFirstOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBroadcastFirstOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBroadcastFirst' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBroadcastFirst' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBroadcastFirstOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBroadcastFirstOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBroadcastFirstOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformBroadcastFirstOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformBroadcastFirstOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBroadcastFirstOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformBroadcastFirstOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBroadcastFirstOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBroadcastFirstOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformBroadcastFirstOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformBroadcastFirstOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBroadcastFirstOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBroadcastFirstOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformBroadcastFirstOp::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); } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBroadcastFirstOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBroadcastFirstOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBroadcastFirstOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformBroadcastFirstOp::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); } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBroadcastFirstOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value)); } void GroupNonUniformBroadcastFirstOp::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(); ::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."); } } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBroadcastFirstOp::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(); ::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(GroupNonUniformBroadcastFirstOp::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)."); } } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBroadcastFirstOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformBroadcastFirstOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformBroadcastFirstOp::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)."); } } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastFirstOp GroupNonUniformBroadcastFirstOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBroadcastFirstOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*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_SPIRVOps31(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {value, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBroadcastFirstOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupNonUniformBroadcastFirstOp::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 GroupNonUniformBroadcastFirstOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); valueRawType = type; } result.addTypes(valueTypes[0]); if (parser.resolveOperands(allOperands, valueTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBroadcastFirstOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupNonUniformBroadcastFirstOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBroadcastFirstOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBroadcastFirstOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformBroadcastOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformBroadcastOpGenericAdaptorBase::GroupNonUniformBroadcastOpGenericAdaptorBase(GroupNonUniformBroadcastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformBroadcastOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformBroadcastOpAdaptor::GroupNonUniformBroadcastOpAdaptor(GroupNonUniformBroadcastOp op) : GroupNonUniformBroadcastOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformBroadcastOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformBroadcast' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformBroadcast' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBroadcastOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformBroadcastOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformBroadcastOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformBroadcastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformBroadcastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformBroadcastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformBroadcastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBroadcastOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBroadcastOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformBroadcastOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformBroadcastOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformBroadcastOp::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); } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformBroadcastOp::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); } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformBroadcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformBroadcastOp::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(); ::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."); } } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBroadcastOp::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(); ::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(GroupNonUniformBroadcastOp::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)."); } } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformBroadcastOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformBroadcastOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformBroadcastOp::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)."); } } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformBroadcastOp GroupNonUniformBroadcastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformBroadcastOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps31(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {value, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformBroadcastOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GroupNonUniformBroadcastOp::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 GroupNonUniformBroadcastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type idRawType{}; ::llvm::ArrayRef<::mlir::Type> idTypes(&idRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); idRawType = type; } result.addTypes(valueTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(valueTypes), ::llvm::ArrayRef<::mlir::Type>(idTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformBroadcastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _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 = getId().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupNonUniformBroadcastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformBroadcastOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformBroadcastOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformElectOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformElectOpGenericAdaptorBase::GroupNonUniformElectOpGenericAdaptorBase(GroupNonUniformElectOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformElectOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformElectOpAdaptor::GroupNonUniformElectOpAdaptor(GroupNonUniformElectOp op) : GroupNonUniformElectOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformElectOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformElect' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformElect' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformElectOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformElectOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformElectOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformElectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformElectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformElectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformElectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformElectOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformElectOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformElectOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformElectOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformElectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope) { odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope)); } void GroupNonUniformElectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope) { odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformElectOp::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); } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope) { return create(builder, builder.getLoc(), std::forward(execution_scope)); } void GroupNonUniformElectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope) { odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope)); } void GroupNonUniformElectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope)); } void GroupNonUniformElectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformElectOp::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); } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope) { return create(builder, builder.getLoc(), std::forward(execution_scope)); } void GroupNonUniformElectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope)); } void GroupNonUniformElectOp::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() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } GroupNonUniformElectOp GroupNonUniformElectOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformElectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { assert(operands.size() == 0u && "mismatched number of parameters"); odsState.addOperands(operands); odsState.addAttributes(attributes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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(GroupNonUniformElectOp::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)."); } } GroupNonUniformElectOp GroupNonUniformElectOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformElectOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformElectOp GroupNonUniformElectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformElectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformElectOp::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)."); } } GroupNonUniformElectOp GroupNonUniformElectOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformElectOp GroupNonUniformElectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformElectOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps4(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformElectOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupNonUniformElectOp::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 GroupNonUniformElectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; { 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::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); return ::mlir::success(); } void GroupNonUniformElectOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformElectOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformElectOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformFAddOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformFAddOpGenericAdaptorBase::GroupNonUniformFAddOpGenericAdaptorBase(GroupNonUniformFAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformFAddOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformFAddOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformFAddOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformFAddOpAdaptor::GroupNonUniformFAddOpAdaptor(GroupNonUniformFAddOp op) : GroupNonUniformFAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformFAddOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformFAdd' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformFAdd' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformFAdd' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformFAdd' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformFAddOp::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 GroupNonUniformFAddOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformFAddOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformFAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformFAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformFAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformFAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformFAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformFAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformFAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformFAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformFAddOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformFAddOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformFAddOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformFAddOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFAddOp::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(); ::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."); } } GroupNonUniformFAddOp GroupNonUniformFAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFAddOp GroupNonUniformFAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformFAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformFAddOp GroupNonUniformFAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFAddOp GroupNonUniformFAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformFAddOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps5(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformFAddOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformFAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformFAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformFAddOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformFAddOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformFMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformFMaxOpGenericAdaptorBase::GroupNonUniformFMaxOpGenericAdaptorBase(GroupNonUniformFMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformFMaxOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformFMaxOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformFMaxOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformFMaxOpAdaptor::GroupNonUniformFMaxOpAdaptor(GroupNonUniformFMaxOp op) : GroupNonUniformFMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformFMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformFMax' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformFMax' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformFMax' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformFMax' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformFMaxOp::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 GroupNonUniformFMaxOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformFMaxOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformFMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformFMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformFMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformFMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformFMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformFMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformFMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformFMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformFMaxOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformFMaxOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformFMaxOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformFMaxOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMaxOp::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(); ::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."); } } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformFMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMaxOp GroupNonUniformFMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformFMaxOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps5(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformFMaxOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformFMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformFMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformFMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformFMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformFMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformFMinOpGenericAdaptorBase::GroupNonUniformFMinOpGenericAdaptorBase(GroupNonUniformFMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformFMinOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformFMinOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformFMinOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformFMinOpAdaptor::GroupNonUniformFMinOpAdaptor(GroupNonUniformFMinOp op) : GroupNonUniformFMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformFMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformFMin' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformFMin' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformFMin' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformFMin' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformFMinOp::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 GroupNonUniformFMinOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformFMinOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformFMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformFMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformFMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformFMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformFMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformFMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformFMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformFMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformFMinOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformFMinOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformFMinOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformFMinOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMinOp::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(); ::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."); } } GroupNonUniformFMinOp GroupNonUniformFMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMinOp GroupNonUniformFMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformFMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformFMinOp GroupNonUniformFMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMinOp GroupNonUniformFMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformFMinOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps5(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformFMinOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformFMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformFMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformFMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformFMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformFMulOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformFMulOpGenericAdaptorBase::GroupNonUniformFMulOpGenericAdaptorBase(GroupNonUniformFMulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformFMulOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformFMulOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformFMulOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformFMulOpAdaptor::GroupNonUniformFMulOpAdaptor(GroupNonUniformFMulOp op) : GroupNonUniformFMulOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformFMulOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformFMul' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformFMul' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformFMul' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformFMul' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformFMulOp::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 GroupNonUniformFMulOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformFMulOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformFMulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformFMulOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformFMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformFMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformFMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformFMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformFMulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformFMulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformFMulOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformFMulOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformFMulOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformFMulOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformFMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformFMulOp::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(); ::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."); } } GroupNonUniformFMulOp GroupNonUniformFMulOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMulOp GroupNonUniformFMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformFMulOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformFMulOp GroupNonUniformFMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformFMulOp GroupNonUniformFMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformFMulOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps5(*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_SPIRVOps10(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformFMulOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformFMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformFMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformFMulOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformFMulOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformIAddOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformIAddOpGenericAdaptorBase::GroupNonUniformIAddOpGenericAdaptorBase(GroupNonUniformIAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformIAddOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformIAddOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformIAddOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformIAddOpAdaptor::GroupNonUniformIAddOpAdaptor(GroupNonUniformIAddOp op) : GroupNonUniformIAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformIAddOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformIAdd' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformIAdd' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformIAdd' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformIAdd' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformIAddOp::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 GroupNonUniformIAddOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformIAddOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformIAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformIAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformIAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformIAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformIAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformIAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformIAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformIAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformIAddOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformIAddOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformIAddOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformIAddOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformIAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformIAddOp::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(); ::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."); } } GroupNonUniformIAddOp GroupNonUniformIAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIAddOp GroupNonUniformIAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformIAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformIAddOp GroupNonUniformIAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIAddOp GroupNonUniformIAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformIAddOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformIAddOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformIAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformIAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformIAddOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformIAddOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformIMulOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformIMulOpGenericAdaptorBase::GroupNonUniformIMulOpGenericAdaptorBase(GroupNonUniformIMulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformIMulOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformIMulOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformIMulOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformIMulOpAdaptor::GroupNonUniformIMulOpAdaptor(GroupNonUniformIMulOp op) : GroupNonUniformIMulOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformIMulOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformIMul' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformIMul' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformIMul' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformIMul' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformIMulOp::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 GroupNonUniformIMulOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformIMulOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformIMulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformIMulOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformIMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformIMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformIMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformIMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformIMulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformIMulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformIMulOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformIMulOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformIMulOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformIMulOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformIMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformIMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformIMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformIMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformIMulOp::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(); ::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."); } } GroupNonUniformIMulOp GroupNonUniformIMulOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIMulOp GroupNonUniformIMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformIMulOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformIMulOp GroupNonUniformIMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformIMulOp GroupNonUniformIMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformIMulOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformIMulOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformIMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformIMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformIMulOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformIMulOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformLogicalAndOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformLogicalAndOpGenericAdaptorBase::GroupNonUniformLogicalAndOpGenericAdaptorBase(GroupNonUniformLogicalAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformLogicalAndOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformLogicalAndOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformLogicalAndOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformLogicalAndOpAdaptor::GroupNonUniformLogicalAndOpAdaptor(GroupNonUniformLogicalAndOp op) : GroupNonUniformLogicalAndOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformLogicalAndOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformLogicalAnd' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformLogicalAnd' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformLogicalAnd' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformLogicalAnd' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformLogicalAndOp::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 GroupNonUniformLogicalAndOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformLogicalAndOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformLogicalAndOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformLogicalAndOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformLogicalAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformLogicalAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformLogicalAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformLogicalAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformLogicalAndOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformLogicalAndOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformLogicalAndOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformLogicalAndOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformLogicalAndOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformLogicalAndOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformLogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalAndOp::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(); ::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."); } } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformLogicalAndOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalAndOp GroupNonUniformLogicalAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformLogicalAndOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*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_SPIRVOps5(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformLogicalAndOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformLogicalAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformLogicalAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformLogicalAndOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformLogicalAndOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformLogicalOrOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformLogicalOrOpGenericAdaptorBase::GroupNonUniformLogicalOrOpGenericAdaptorBase(GroupNonUniformLogicalOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformLogicalOrOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformLogicalOrOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformLogicalOrOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformLogicalOrOpAdaptor::GroupNonUniformLogicalOrOpAdaptor(GroupNonUniformLogicalOrOp op) : GroupNonUniformLogicalOrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformLogicalOrOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformLogicalOr' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformLogicalOr' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformLogicalOr' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformLogicalOr' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformLogicalOrOp::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 GroupNonUniformLogicalOrOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformLogicalOrOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformLogicalOrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformLogicalOrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformLogicalOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformLogicalOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformLogicalOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformLogicalOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformLogicalOrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformLogicalOrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformLogicalOrOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformLogicalOrOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformLogicalOrOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformLogicalOrOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformLogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalOrOp::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(); ::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."); } } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformLogicalOrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalOrOp GroupNonUniformLogicalOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformLogicalOrOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*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_SPIRVOps5(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformLogicalOrOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformLogicalOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformLogicalOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformLogicalOrOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformLogicalOrOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformLogicalXorOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformLogicalXorOpGenericAdaptorBase::GroupNonUniformLogicalXorOpGenericAdaptorBase(GroupNonUniformLogicalXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformLogicalXorOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformLogicalXorOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformLogicalXorOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformLogicalXorOpAdaptor::GroupNonUniformLogicalXorOpAdaptor(GroupNonUniformLogicalXorOp op) : GroupNonUniformLogicalXorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformLogicalXorOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformLogicalXor' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformLogicalXor' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformLogicalXor' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformLogicalXor' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformLogicalXorOp::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 GroupNonUniformLogicalXorOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformLogicalXorOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformLogicalXorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformLogicalXorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformLogicalXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformLogicalXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformLogicalXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformLogicalXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformLogicalXorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformLogicalXorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformLogicalXorOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformLogicalXorOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformLogicalXorOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformLogicalXorOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformLogicalXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformLogicalXorOp::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(); ::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."); } } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformLogicalXorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformLogicalXorOp GroupNonUniformLogicalXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformLogicalXorOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*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_SPIRVOps5(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformLogicalXorOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformLogicalXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformLogicalXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformLogicalXorOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformLogicalXorOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformQuadSwapOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformQuadSwapOpGenericAdaptorBase::GroupNonUniformQuadSwapOpGenericAdaptorBase(GroupNonUniformQuadSwapOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformQuadSwapOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::QuadSwapDirection GroupNonUniformQuadSwapOpGenericAdaptorBase::getDirection() { auto attr = getDirectionAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformQuadSwapOpAdaptor::GroupNonUniformQuadSwapOpAdaptor(GroupNonUniformQuadSwapOp op) : GroupNonUniformQuadSwapOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformQuadSwapOpAdaptor::verify(::mlir::Location loc) { auto tblgen_direction = getProperties().direction; (void)tblgen_direction; if (!tblgen_direction) return emitError(loc, "'spirv.GroupNonUniformQuadSwap' op requires attribute 'direction'"); auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformQuadSwap' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformQuadSwap' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_direction && !((::llvm::isa<::mlir::spirv::QuadSwapDirectionAttr>(tblgen_direction)))) return emitError(loc, "'spirv.GroupNonUniformQuadSwap' op attribute 'direction' failed to satisfy constraint: Swap direction of a GroupNonUniformQuadSwap"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformQuadSwapOp::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.direction; auto attr = dict.get("direction"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `direction` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformQuadSwapOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.direction; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("direction", propStorage)); } { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformQuadSwapOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.direction.getAsOpaquePointer()), llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformQuadSwapOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "direction") return prop.direction; if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformQuadSwapOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "direction") { prop.direction = ::llvm::dyn_cast_or_null>(value); return; } if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformQuadSwapOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.direction) attrs.append("direction", prop.direction); if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformQuadSwapOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getDirectionAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps22(attr, "direction", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformQuadSwapOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.direction))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformQuadSwapOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.direction); writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformQuadSwapOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::QuadSwapDirection GroupNonUniformQuadSwapOp::getDirection() { auto attr = getDirectionAttr(); return attr.getValue(); } void GroupNonUniformQuadSwapOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformQuadSwapOp::setDirection(::mlir::spirv::QuadSwapDirection attrValue) { getProperties().direction = ::mlir::spirv::QuadSwapDirectionAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformQuadSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().direction = direction; odsState.addTypes(result); } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(direction)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(direction)); } void GroupNonUniformQuadSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().direction = direction; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformQuadSwapOp::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); } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(direction)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(direction)); } void GroupNonUniformQuadSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().direction = direction; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(direction)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirectionAttr direction) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(direction)); } void GroupNonUniformQuadSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().direction = ::mlir::spirv::QuadSwapDirectionAttr::get(odsBuilder.getContext(), direction); odsState.addTypes(result); } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(direction)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(direction)); } void GroupNonUniformQuadSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().direction = ::mlir::spirv::QuadSwapDirectionAttr::get(odsBuilder.getContext(), direction); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformQuadSwapOp::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); } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(direction)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(direction)); } void GroupNonUniformQuadSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { odsState.addOperands(value); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().direction = ::mlir::spirv::QuadSwapDirectionAttr::get(odsBuilder.getContext(), direction); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(direction)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::spirv::QuadSwapDirection direction) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(direction)); } void GroupNonUniformQuadSwapOp::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(); ::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."); } } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformQuadSwapOp::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(); ::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(GroupNonUniformQuadSwapOp::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)."); } } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformQuadSwapOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformQuadSwapOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformQuadSwapOp::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)."); } } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformQuadSwapOp GroupNonUniformQuadSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformQuadSwapOp::verifyInvariantsImpl() { auto tblgen_direction = getProperties().direction; (void)tblgen_direction; if (!tblgen_direction) return emitOpError("requires attribute 'direction'"); auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps22(*this, tblgen_direction, "direction"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*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_SPIRVOps31(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Subgroup'"); if (!((((*this->getODSOperands(0).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 {value, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformQuadSwapOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupNonUniformQuadSwapOp::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 GroupNonUniformQuadSwapOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::QuadSwapDirectionAttr directionAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(directionAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (directionAttr) result.getOrAddProperties().direction = directionAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) 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(); valueRawType = type; } result.addTypes(valueTypes[0]); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformQuadSwapOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getDirectionAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("direction"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformQuadSwapOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformQuadSwapOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformRotateKHROp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformRotateKHROpGenericAdaptorBase::GroupNonUniformRotateKHROpGenericAdaptorBase(GroupNonUniformRotateKHROp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformRotateKHROpGenericAdaptorBase::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}; } ::mlir::spirv::Scope GroupNonUniformRotateKHROpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformRotateKHROpAdaptor::GroupNonUniformRotateKHROpAdaptor(GroupNonUniformRotateKHROp op) : GroupNonUniformRotateKHROpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformRotateKHROpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformRotateKHR' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformRotateKHR' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } std::pair GroupNonUniformRotateKHROp::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 GroupNonUniformRotateKHROp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(2); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformRotateKHROp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformRotateKHROp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformRotateKHROp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformRotateKHROp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformRotateKHROp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformRotateKHROp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformRotateKHROp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformRotateKHROp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformRotateKHROp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformRotateKHROp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformRotateKHROp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformRotateKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); odsState.addOperands(delta); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); } void GroupNonUniformRotateKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); odsState.addOperands(delta); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformRotateKHROp::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); } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); } void GroupNonUniformRotateKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); odsState.addOperands(delta); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); } void GroupNonUniformRotateKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); odsState.addOperands(delta); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); } void GroupNonUniformRotateKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); odsState.addOperands(delta); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformRotateKHROp::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); } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); } void GroupNonUniformRotateKHROp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); odsState.addOperands(delta); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta), std::forward(cluster_size)); } void GroupNonUniformRotateKHROp::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(); ::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."); } } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformRotateKHROp::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(); ::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(GroupNonUniformRotateKHROp::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)."); } } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformRotateKHROp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformRotateKHROp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformRotateKHROp::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)."); } } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformRotateKHROp GroupNonUniformRotateKHROp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformRotateKHROp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps33(*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_SPIRVOps33(*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_SPIRVOps31(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {value, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformRotateKHROp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GroupNonUniformRotateKHROp::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 GroupNonUniformRotateKHROp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand deltaRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> deltaOperands(&deltaRawOperand, 1); ::llvm::SMLoc deltaOperandsLoc; (void)deltaOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type deltaRawType{}; ::llvm::ArrayRef<::mlir::Type> deltaTypes(&deltaRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); deltaOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(deltaRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseKeyword("cluster_size")) return ::mlir::failure(); if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); deltaRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(deltaOperands, deltaTypes, deltaOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformRotateKHROp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getDelta(); if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _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 = getDelta().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void GroupNonUniformRotateKHROp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformRotateKHROp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformRotateKHROpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformSMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformSMaxOpGenericAdaptorBase::GroupNonUniformSMaxOpGenericAdaptorBase(GroupNonUniformSMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformSMaxOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformSMaxOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformSMaxOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformSMaxOpAdaptor::GroupNonUniformSMaxOpAdaptor(GroupNonUniformSMaxOp op) : GroupNonUniformSMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformSMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformSMax' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformSMax' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformSMax' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformSMax' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformSMaxOp::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 GroupNonUniformSMaxOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformSMaxOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformSMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformSMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformSMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformSMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformSMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformSMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformSMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformSMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformSMaxOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformSMaxOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformSMaxOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformSMaxOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformSMaxOp::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(); ::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."); } } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformSMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMaxOp GroupNonUniformSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformSMaxOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformSMaxOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformSMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformSMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformSMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformSMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformSMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformSMinOpGenericAdaptorBase::GroupNonUniformSMinOpGenericAdaptorBase(GroupNonUniformSMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformSMinOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformSMinOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformSMinOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformSMinOpAdaptor::GroupNonUniformSMinOpAdaptor(GroupNonUniformSMinOp op) : GroupNonUniformSMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformSMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformSMin' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformSMin' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformSMin' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformSMin' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformSMinOp::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 GroupNonUniformSMinOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformSMinOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformSMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformSMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformSMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformSMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformSMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformSMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformSMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformSMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformSMinOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformSMinOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformSMinOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformSMinOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformSMinOp::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(); ::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."); } } GroupNonUniformSMinOp GroupNonUniformSMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMinOp GroupNonUniformSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformSMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformSMinOp GroupNonUniformSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformSMinOp GroupNonUniformSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformSMinOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformSMinOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformSMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformSMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformSMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformSMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformShuffleDownOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformShuffleDownOpGenericAdaptorBase::GroupNonUniformShuffleDownOpGenericAdaptorBase(GroupNonUniformShuffleDownOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformShuffleDownOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformShuffleDownOpAdaptor::GroupNonUniformShuffleDownOpAdaptor(GroupNonUniformShuffleDownOp op) : GroupNonUniformShuffleDownOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformShuffleDownOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformShuffleDown' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformShuffleDown' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleDownOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformShuffleDownOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformShuffleDownOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformShuffleDownOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformShuffleDownOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformShuffleDownOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformShuffleDownOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleDownOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformShuffleDownOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformShuffleDownOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformShuffleDownOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformShuffleDownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleDownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleDownOp::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); } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleDownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleDownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleDownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleDownOp::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); } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleDownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleDownOp::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(); ::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."); } } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformShuffleDownOp::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(); ::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(GroupNonUniformShuffleDownOp::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)."); } } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformShuffleDownOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformShuffleDownOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleDownOp::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)."); } } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleDownOp GroupNonUniformShuffleDownOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformShuffleDownOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {value, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleDownOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GroupNonUniformShuffleDownOp::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 GroupNonUniformShuffleDownOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type deltaRawType{}; ::llvm::ArrayRef<::mlir::Type> deltaTypes(&deltaRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); deltaRawType = type; } result.addTypes(valueTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(valueTypes), ::llvm::ArrayRef<::mlir::Type>(deltaTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformShuffleDownOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _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 = getDelta().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupNonUniformShuffleDownOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformShuffleDownOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformShuffleDownOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformShuffleOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformShuffleOpGenericAdaptorBase::GroupNonUniformShuffleOpGenericAdaptorBase(GroupNonUniformShuffleOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformShuffleOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformShuffleOpAdaptor::GroupNonUniformShuffleOpAdaptor(GroupNonUniformShuffleOp op) : GroupNonUniformShuffleOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformShuffleOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformShuffle' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformShuffle' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformShuffleOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformShuffleOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformShuffleOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformShuffleOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformShuffleOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformShuffleOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformShuffleOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformShuffleOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformShuffleOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleOp::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); } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleOp::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); } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { odsState.addOperands(value); odsState.addOperands(id); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(id)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value id) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(id)); } void GroupNonUniformShuffleOp::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(); ::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."); } } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformShuffleOp::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(); ::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(GroupNonUniformShuffleOp::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)."); } } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformShuffleOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformShuffleOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleOp::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)."); } } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleOp GroupNonUniformShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformShuffleOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps31(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {value, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GroupNonUniformShuffleOp::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 GroupNonUniformShuffleOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type idRawType{}; ::llvm::ArrayRef<::mlir::Type> idTypes(&idRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); idRawType = type; } result.addTypes(valueTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(valueTypes), ::llvm::ArrayRef<::mlir::Type>(idTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformShuffleOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _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 = getId().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupNonUniformShuffleOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformShuffleOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformShuffleOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformShuffleUpOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformShuffleUpOpGenericAdaptorBase::GroupNonUniformShuffleUpOpGenericAdaptorBase(GroupNonUniformShuffleUpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformShuffleUpOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformShuffleUpOpAdaptor::GroupNonUniformShuffleUpOpAdaptor(GroupNonUniformShuffleUpOp op) : GroupNonUniformShuffleUpOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformShuffleUpOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformShuffleUp' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformShuffleUp' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleUpOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformShuffleUpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformShuffleUpOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformShuffleUpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformShuffleUpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformShuffleUpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformShuffleUpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleUpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformShuffleUpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformShuffleUpOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformShuffleUpOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformShuffleUpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleUpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleUpOp::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); } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleUpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleUpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleUpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleUpOp::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); } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleUpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { odsState.addOperands(value); odsState.addOperands(delta); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value delta) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(delta)); } void GroupNonUniformShuffleUpOp::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(); ::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."); } } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformShuffleUpOp::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(); ::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(GroupNonUniformShuffleUpOp::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)."); } } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformShuffleUpOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformShuffleUpOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleUpOp::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)."); } } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleUpOp GroupNonUniformShuffleUpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformShuffleUpOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {value, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleUpOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GroupNonUniformShuffleUpOp::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 GroupNonUniformShuffleUpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type deltaRawType{}; ::llvm::ArrayRef<::mlir::Type> deltaTypes(&deltaRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); deltaRawType = type; } result.addTypes(valueTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(valueTypes), ::llvm::ArrayRef<::mlir::Type>(deltaTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformShuffleUpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _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 = getDelta().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupNonUniformShuffleUpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformShuffleUpOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformShuffleUpOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformShuffleXorOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformShuffleXorOpGenericAdaptorBase::GroupNonUniformShuffleXorOpGenericAdaptorBase(GroupNonUniformShuffleXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupNonUniformShuffleXorOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformShuffleXorOpAdaptor::GroupNonUniformShuffleXorOpAdaptor(GroupNonUniformShuffleXorOp op) : GroupNonUniformShuffleXorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformShuffleXorOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformShuffleXor' op requires attribute 'execution_scope'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformShuffleXor' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleXorOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformShuffleXorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformShuffleXorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer())); } std::optional GroupNonUniformShuffleXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; return std::nullopt; } void GroupNonUniformShuffleXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformShuffleXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); } ::llvm::LogicalResult GroupNonUniformShuffleXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleXorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformShuffleXorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); } ::mlir::spirv::Scope GroupNonUniformShuffleXorOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } void GroupNonUniformShuffleXorOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformShuffleXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { odsState.addOperands(value); odsState.addOperands(mask); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.addTypes(result); } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(mask)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(mask)); } void GroupNonUniformShuffleXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { odsState.addOperands(value); odsState.addOperands(mask); odsState.getOrAddProperties().execution_scope = execution_scope; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleXorOp::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); } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(mask)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(mask)); } void GroupNonUniformShuffleXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { odsState.addOperands(value); odsState.addOperands(mask); odsState.getOrAddProperties().execution_scope = execution_scope; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(mask)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::Value value, ::mlir::Value mask) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(mask)); } void GroupNonUniformShuffleXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { odsState.addOperands(value); odsState.addOperands(mask); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.addTypes(result); } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(mask)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(value), std::forward(mask)); } void GroupNonUniformShuffleXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { odsState.addOperands(value); odsState.addOperands(mask); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleXorOp::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); } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(value), std::forward(mask)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(value), std::forward(mask)); } void GroupNonUniformShuffleXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { odsState.addOperands(value); odsState.addOperands(mask); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(mask)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::Value value, ::mlir::Value mask) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(value), std::forward(mask)); } void GroupNonUniformShuffleXorOp::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(); ::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."); } } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformShuffleXorOp::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(); ::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(GroupNonUniformShuffleXorOp::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)."); } } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupNonUniformShuffleXorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupNonUniformShuffleXorOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupNonUniformShuffleXorOp::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)."); } } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformShuffleXorOp GroupNonUniformShuffleXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformShuffleXorOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps31(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {value, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformShuffleXorOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult GroupNonUniformShuffleXorOp::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 GroupNonUniformShuffleXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::mlir::Type maskRawType{}; ::llvm::ArrayRef<::mlir::Type> maskTypes(&maskRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); valueRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); maskRawType = type; } result.addTypes(valueTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(valueTypes), ::llvm::ArrayRef<::mlir::Type>(maskTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformShuffleXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _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 = getMask().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupNonUniformShuffleXorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformShuffleXorOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformShuffleXorOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformUMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformUMaxOpGenericAdaptorBase::GroupNonUniformUMaxOpGenericAdaptorBase(GroupNonUniformUMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformUMaxOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformUMaxOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformUMaxOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformUMaxOpAdaptor::GroupNonUniformUMaxOpAdaptor(GroupNonUniformUMaxOp op) : GroupNonUniformUMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformUMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformUMax' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformUMax' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformUMax' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformUMax' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformUMaxOp::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 GroupNonUniformUMaxOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformUMaxOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformUMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformUMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformUMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformUMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformUMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformUMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformUMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformUMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformUMaxOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformUMaxOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformUMaxOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformUMaxOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformUMaxOp::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(); ::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."); } } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformUMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMaxOp GroupNonUniformUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformUMaxOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformUMaxOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformUMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformUMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformUMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformUMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupNonUniformUMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupNonUniformUMinOpGenericAdaptorBase::GroupNonUniformUMinOpGenericAdaptorBase(GroupNonUniformUMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair GroupNonUniformUMinOpGenericAdaptorBase::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::spirv::Scope GroupNonUniformUMinOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformUMinOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupNonUniformUMinOpAdaptor::GroupNonUniformUMinOpAdaptor(GroupNonUniformUMinOp op) : GroupNonUniformUMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupNonUniformUMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupNonUniformUMin' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupNonUniformUMin' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupNonUniformUMin' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupNonUniformUMin' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } std::pair GroupNonUniformUMinOp::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 GroupNonUniformUMinOp::getClusterSizeMutable() { auto range = getODSOperandIndexAndLength(1); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult GroupNonUniformUMinOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupNonUniformUMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupNonUniformUMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupNonUniformUMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupNonUniformUMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupNonUniformUMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupNonUniformUMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformUMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupNonUniformUMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupNonUniformUMinOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupNonUniformUMinOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupNonUniformUMinOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformUMinOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupNonUniformUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { odsState.addOperands(value); if (cluster_size) odsState.addOperands(cluster_size); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value value, /*optional*/::mlir::Value cluster_size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(value), std::forward(cluster_size)); } void GroupNonUniformUMinOp::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(); ::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."); } } GroupNonUniformUMinOp GroupNonUniformUMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMinOp GroupNonUniformUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupNonUniformUMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupNonUniformUMinOp GroupNonUniformUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupNonUniformUMinOp GroupNonUniformUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupNonUniformUMinOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupNonUniformUMinOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult GroupNonUniformUMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc; (void)valueOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cluster_sizeOperands; ::llvm::SMLoc cluster_sizeOperandsLoc; (void)cluster_sizeOperandsLoc; ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> cluster_sizeTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalKeyword("cluster_size"))) { if (parser.parseLParen()) return ::mlir::failure(); { cluster_sizeOperandsLoc = parser.getCurrentLocation(); ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeOperands.push_back(operand); } } 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(); valueRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { { ::mlir::Type optionalType; ::mlir::OptionalParseResult parseResult = parser.parseOptionalType(optionalType); if (parseResult.has_value()) { if (failed(*parseResult)) return ::mlir::failure(); cluster_sizeTypes.push_back(optionalType); } } } if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); if (!cluster_sizeOperands.empty()) { if (parser.resolveOperands(cluster_sizeOperands, cluster_sizeTypes, cluster_sizeOperandsLoc, result.operands)) return ::mlir::failure(); } return ::mlir::success(); } void GroupNonUniformUMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getValue(); if (getClusterSize()) { _odsPrinter << ' ' << "cluster_size"; _odsPrinter << "("; if (::mlir::Value value = getClusterSize()) _odsPrinter << value; _odsPrinter << ")"; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (getClusterSize()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << (getClusterSize() ? ::llvm::ArrayRef<::mlir::Type>(getClusterSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupNonUniformUMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupNonUniformUMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupSMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupSMaxOpGenericAdaptorBase::GroupSMaxOpGenericAdaptorBase(GroupSMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupSMaxOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupSMaxOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupSMaxOpAdaptor::GroupSMaxOpAdaptor(GroupSMaxOp op) : GroupSMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupSMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupSMax' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupSMax' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupSMax' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupSMax' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupSMaxOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupSMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupSMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupSMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupSMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupSMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupSMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupSMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupSMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupSMaxOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupSMaxOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupSMaxOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupSMaxOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupSMaxOp GroupSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupSMaxOp::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); } GroupSMaxOp GroupSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupSMaxOp GroupSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupSMaxOp GroupSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupSMaxOp::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); } GroupSMaxOp GroupSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupSMaxOp GroupSMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMaxOp::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(); ::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."); } } GroupSMaxOp GroupSMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupSMaxOp::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(); ::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(GroupSMaxOp::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)."); } } GroupSMaxOp GroupSMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupSMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupSMaxOp GroupSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupSMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupSMaxOp::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)."); } } GroupSMaxOp GroupSMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMaxOp GroupSMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupSMaxOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupSMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupSMaxOp::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 GroupSMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupSMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupSMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupSMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupSMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupSMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupSMinOpGenericAdaptorBase::GroupSMinOpGenericAdaptorBase(GroupSMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupSMinOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupSMinOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupSMinOpAdaptor::GroupSMinOpAdaptor(GroupSMinOp op) : GroupSMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupSMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupSMin' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupSMin' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupSMin' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupSMin' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupSMinOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupSMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupSMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupSMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupSMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupSMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupSMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupSMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupSMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupSMinOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupSMinOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupSMinOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupSMinOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupSMinOp GroupSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupSMinOp::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); } GroupSMinOp GroupSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupSMinOp GroupSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupSMinOp GroupSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupSMinOp::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); } GroupSMinOp GroupSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupSMinOp GroupSMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupSMinOp::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(); ::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."); } } GroupSMinOp GroupSMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupSMinOp::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(); ::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(GroupSMinOp::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)."); } } GroupSMinOp GroupSMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupSMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupSMinOp GroupSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupSMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupSMinOp::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)."); } } GroupSMinOp GroupSMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupSMinOp GroupSMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupSMinOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupSMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupSMinOp::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 GroupSMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupSMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupSMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupSMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupSMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupUMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupUMaxOpGenericAdaptorBase::GroupUMaxOpGenericAdaptorBase(GroupUMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupUMaxOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupUMaxOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupUMaxOpAdaptor::GroupUMaxOpAdaptor(GroupUMaxOp op) : GroupUMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupUMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupUMax' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupUMax' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupUMax' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupUMax' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupUMaxOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupUMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupUMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupUMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupUMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupUMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupUMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupUMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupUMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupUMaxOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupUMaxOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupUMaxOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupUMaxOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupUMaxOp GroupUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupUMaxOp::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); } GroupUMaxOp GroupUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupUMaxOp GroupUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupUMaxOp GroupUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupUMaxOp::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); } GroupUMaxOp GroupUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupUMaxOp GroupUMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMaxOp::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(); ::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."); } } GroupUMaxOp GroupUMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupUMaxOp::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(); ::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(GroupUMaxOp::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)."); } } GroupUMaxOp GroupUMaxOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupUMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupUMaxOp GroupUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupUMaxOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupUMaxOp::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)."); } } GroupUMaxOp GroupUMaxOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMaxOp GroupUMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupUMaxOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupUMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupUMaxOp::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 GroupUMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupUMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupUMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupUMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupUMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::GroupUMinOp definitions //===----------------------------------------------------------------------===// namespace detail { GroupUMinOpGenericAdaptorBase::GroupUMinOpGenericAdaptorBase(GroupUMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope GroupUMinOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupUMinOpGenericAdaptorBase::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } } // namespace detail GroupUMinOpAdaptor::GroupUMinOpAdaptor(GroupUMinOp op) : GroupUMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult GroupUMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.GroupUMin' op requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitError(loc, "'spirv.GroupUMin' op requires attribute 'group_operation'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.GroupUMin' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_group_operation && !((::llvm::isa<::mlir::spirv::GroupOperationAttr>(tblgen_group_operation)))) return emitError(loc, "'spirv.GroupUMin' op attribute 'group_operation' failed to satisfy constraint: valid SPIR-V GroupOperation"); return ::mlir::success(); } ::llvm::LogicalResult GroupUMinOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.group_operation; auto attr = dict.get("group_operation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `group_operation` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute GroupUMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.group_operation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("group_operation", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code GroupUMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.group_operation.getAsOpaquePointer())); } std::optional GroupUMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "group_operation") return prop.group_operation; return std::nullopt; } void GroupUMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "group_operation") { prop.group_operation = ::llvm::dyn_cast_or_null>(value); return; } } void GroupUMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.group_operation) attrs.append("group_operation", prop.group_operation); } ::llvm::LogicalResult GroupUMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getGroupOperationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(attr, "group_operation", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult GroupUMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.group_operation))) return ::mlir::failure(); return ::mlir::success(); } void GroupUMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.group_operation); } ::mlir::spirv::Scope GroupUMinOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::GroupOperation GroupUMinOp::getGroupOperation() { auto attr = getGroupOperationAttr(); return attr.getValue(); } void GroupUMinOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupUMinOp::setGroupOperation(::mlir::spirv::GroupOperation attrValue) { getProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void GroupUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; odsState.addTypes(result); } GroupUMinOp GroupUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupUMinOp::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); } GroupUMinOp GroupUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().group_operation = group_operation; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupUMinOp GroupUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::GroupOperationAttr group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); odsState.addTypes(result); } GroupUMinOp GroupUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(result), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupUMinOp::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); } GroupUMinOp GroupUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { odsState.addOperands(x); odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().group_operation = ::mlir::spirv::GroupOperationAttr::get(odsBuilder.getContext(), group_operation); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } GroupUMinOp GroupUMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::GroupOperation group_operation, ::mlir::Value x) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(group_operation), std::forward(x)); } void GroupUMinOp::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(); ::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."); } } GroupUMinOp GroupUMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void GroupUMinOp::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(); ::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(GroupUMinOp::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)."); } } GroupUMinOp GroupUMinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void GroupUMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } GroupUMinOp GroupUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void GroupUMinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(GroupUMinOp::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)."); } } GroupUMinOp GroupUMinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } GroupUMinOp GroupUMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult GroupUMinOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_group_operation = getProperties().group_operation; (void)tblgen_group_operation; if (!tblgen_group_operation) return emitOpError("requires attribute 'group_operation'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps21(*this, tblgen_group_operation, "group_operation"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {x, result} have same type"); if (!((::llvm::is_contained({::mlir::spirv::Scope::Workgroup, ::mlir::spirv::Scope::Subgroup}, ::llvm::cast<::mlir::spirv::ScopeAttr>(getProperties().execution_scope).getValue())))) return emitOpError("failed to verify that execution_scope must be 'Workgroup' or 'Subgroup'"); return ::mlir::success(); } ::llvm::LogicalResult GroupUMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult GroupUMinOp::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 GroupUMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::GroupOperationAttr group_operationAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type xRawType{}; ::llvm::ArrayRef<::mlir::Type> xTypes(&xRawType, 1); if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(group_operationAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (group_operationAttr) result.getOrAddProperties().group_operation = group_operationAttr; [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); xRawType = type; } result.addTypes(xTypes[0]); if (parser.resolveOperands(allOperands, xTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void GroupUMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getGroupOperationAttr()); _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("group_operation"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getX().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void GroupUMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::GroupUMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::GroupUMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::IAddCarryOp definitions //===----------------------------------------------------------------------===// namespace detail { IAddCarryOpGenericAdaptorBase::IAddCarryOpGenericAdaptorBase(IAddCarryOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail IAddCarryOpAdaptor::IAddCarryOpAdaptor(IAddCarryOp op) : IAddCarryOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult IAddCarryOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult IAddCarryOp::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 IAddCarryOp::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 IAddCarryOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional IAddCarryOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void IAddCarryOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void IAddCarryOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult IAddCarryOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void IAddCarryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value operand1, Value operand2) { build(odsBuilder, odsState, ::mlir::spirv::StructType::get({operand1.getType(), operand1.getType()}), operand1, operand2); } IAddCarryOp IAddCarryOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value operand1, Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddCarryOp IAddCarryOp::create(::mlir::ImplicitLocOpBuilder &builder, Value operand1, Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void IAddCarryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } IAddCarryOp IAddCarryOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddCarryOp IAddCarryOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void IAddCarryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } IAddCarryOp IAddCarryOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddCarryOp IAddCarryOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void IAddCarryOp::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); } IAddCarryOp IAddCarryOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddCarryOp IAddCarryOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void IAddCarryOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } IAddCarryOp IAddCarryOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddCarryOp IAddCarryOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult IAddCarryOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps25(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult IAddCarryOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult IAddCarryOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void IAddCarryOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::IAddCarryOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::IAddOp definitions //===----------------------------------------------------------------------===// namespace detail { IAddOpGenericAdaptorBase::IAddOpGenericAdaptorBase(IAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail IAddOpAdaptor::IAddOpAdaptor(IAddOp op) : IAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult IAddOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult IAddOp::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 IAddOp::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 IAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional IAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void IAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void IAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult IAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void IAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } IAddOp IAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddOp IAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void IAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IAddOp::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); } IAddOp IAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddOp IAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void IAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } IAddOp IAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddOp IAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void IAddOp::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); } IAddOp IAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddOp IAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void IAddOp::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(IAddOp::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)."); } } IAddOp IAddOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddOp IAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void IAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } IAddOp IAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddOp IAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void IAddOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IAddOp::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)."); } } IAddOp IAddOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IAddOp IAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult IAddOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps14(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult IAddOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult IAddOp::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 IAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void IAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 IAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::IAddOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::IEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { IEqualOpGenericAdaptorBase::IEqualOpGenericAdaptorBase(IEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail IEqualOpAdaptor::IEqualOpAdaptor(IEqualOp op) : IEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult IEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult IEqualOp::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 IEqualOp::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 IEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional IEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void IEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void IEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult IEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void IEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } IEqualOp IEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IEqualOp IEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void IEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IEqualOp::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); } IEqualOp IEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IEqualOp IEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void IEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } IEqualOp IEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IEqualOp IEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void IEqualOp::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); } IEqualOp IEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IEqualOp IEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void IEqualOp::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(IEqualOp::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)."); } } IEqualOp IEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IEqualOp IEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void IEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } IEqualOp IEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IEqualOp IEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void IEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IEqualOp::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)."); } } IEqualOp IEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IEqualOp IEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult IEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult IEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult IEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult IEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void IEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void IEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::IEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::IMulOp definitions //===----------------------------------------------------------------------===// namespace detail { IMulOpGenericAdaptorBase::IMulOpGenericAdaptorBase(IMulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail IMulOpAdaptor::IMulOpAdaptor(IMulOp op) : IMulOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult IMulOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult IMulOp::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 IMulOp::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 IMulOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional IMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void IMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void IMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult IMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void IMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } IMulOp IMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IMulOp IMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void IMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IMulOp::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); } IMulOp IMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IMulOp IMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void IMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } IMulOp IMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IMulOp IMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void IMulOp::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); } IMulOp IMulOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IMulOp IMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void IMulOp::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(IMulOp::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)."); } } IMulOp IMulOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IMulOp IMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void IMulOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } IMulOp IMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IMulOp IMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void IMulOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IMulOp::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)."); } } IMulOp IMulOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IMulOp IMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult IMulOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps14(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult IMulOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult IMulOp::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 IMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void IMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 IMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::IMulOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELControlBarrierArriveOp definitions //===----------------------------------------------------------------------===// namespace detail { INTELControlBarrierArriveOpGenericAdaptorBase::INTELControlBarrierArriveOpGenericAdaptorBase(INTELControlBarrierArriveOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope INTELControlBarrierArriveOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::Scope INTELControlBarrierArriveOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics INTELControlBarrierArriveOpGenericAdaptorBase::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } } // namespace detail INTELControlBarrierArriveOpAdaptor::INTELControlBarrierArriveOpAdaptor(INTELControlBarrierArriveOp op) : INTELControlBarrierArriveOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELControlBarrierArriveOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.INTEL.ControlBarrierArrive' op requires attribute 'execution_scope'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.INTEL.ControlBarrierArrive' op requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitError(loc, "'spirv.INTEL.ControlBarrierArrive' op requires attribute 'memory_semantics'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.INTEL.ControlBarrierArrive' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.INTEL.ControlBarrierArrive' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_memory_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_memory_semantics)))) return emitError(loc, "'spirv.INTEL.ControlBarrierArrive' op attribute 'memory_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult INTELControlBarrierArriveOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_semantics; auto attr = dict.get("memory_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute INTELControlBarrierArriveOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.memory_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code INTELControlBarrierArriveOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.memory_semantics.getAsOpaquePointer())); } std::optional INTELControlBarrierArriveOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "memory_scope") return prop.memory_scope; if (name == "memory_semantics") return prop.memory_semantics; return std::nullopt; } void INTELControlBarrierArriveOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_semantics") { prop.memory_semantics = ::llvm::dyn_cast_or_null>(value); return; } } void INTELControlBarrierArriveOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.memory_semantics) attrs.append("memory_semantics", prop.memory_semantics); } ::llvm::LogicalResult INTELControlBarrierArriveOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemorySemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "memory_semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult INTELControlBarrierArriveOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_semantics))) return ::mlir::failure(); return ::mlir::success(); } void INTELControlBarrierArriveOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.memory_semantics); } ::mlir::spirv::Scope INTELControlBarrierArriveOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::Scope INTELControlBarrierArriveOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics INTELControlBarrierArriveOp::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } void INTELControlBarrierArriveOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void INTELControlBarrierArriveOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void INTELControlBarrierArriveOp::setMemorySemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void INTELControlBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void INTELControlBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void INTELControlBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void INTELControlBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void INTELControlBarrierArriveOp::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(); ::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."); } } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELControlBarrierArriveOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierArriveOp INTELControlBarrierArriveOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELControlBarrierArriveOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitOpError("requires attribute 'memory_semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_memory_semantics, "memory_semantics"))) return ::mlir::failure(); return ::mlir::success(); } ::llvm::LogicalResult INTELControlBarrierArriveOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult INTELControlBarrierArriveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr memory_semanticsAttr; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(memory_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_semanticsAttr) result.getOrAddProperties().memory_semantics = memory_semanticsAttr; { 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 INTELControlBarrierArriveOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemorySemanticsAttr()); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("memory_semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELControlBarrierArriveOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::INTELControlBarrierArriveOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELControlBarrierWaitOp definitions //===----------------------------------------------------------------------===// namespace detail { INTELControlBarrierWaitOpGenericAdaptorBase::INTELControlBarrierWaitOpGenericAdaptorBase(INTELControlBarrierWaitOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope INTELControlBarrierWaitOpGenericAdaptorBase::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::Scope INTELControlBarrierWaitOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics INTELControlBarrierWaitOpGenericAdaptorBase::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } } // namespace detail INTELControlBarrierWaitOpAdaptor::INTELControlBarrierWaitOpAdaptor(INTELControlBarrierWaitOp op) : INTELControlBarrierWaitOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELControlBarrierWaitOpAdaptor::verify(::mlir::Location loc) { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitError(loc, "'spirv.INTEL.ControlBarrierWait' op requires attribute 'execution_scope'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.INTEL.ControlBarrierWait' op requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitError(loc, "'spirv.INTEL.ControlBarrierWait' op requires attribute 'memory_semantics'"); if (tblgen_execution_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_execution_scope)))) return emitError(loc, "'spirv.INTEL.ControlBarrierWait' op attribute 'execution_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.INTEL.ControlBarrierWait' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_memory_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_memory_semantics)))) return emitError(loc, "'spirv.INTEL.ControlBarrierWait' op attribute 'memory_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult INTELControlBarrierWaitOp::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.execution_scope; auto attr = dict.get("execution_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `execution_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_semantics; auto attr = dict.get("memory_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute INTELControlBarrierWaitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.execution_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("execution_scope", propStorage)); } { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.memory_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code INTELControlBarrierWaitOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.execution_scope.getAsOpaquePointer()), llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.memory_semantics.getAsOpaquePointer())); } std::optional INTELControlBarrierWaitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "execution_scope") return prop.execution_scope; if (name == "memory_scope") return prop.memory_scope; if (name == "memory_semantics") return prop.memory_semantics; return std::nullopt; } void INTELControlBarrierWaitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "execution_scope") { prop.execution_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_semantics") { prop.memory_semantics = ::llvm::dyn_cast_or_null>(value); return; } } void INTELControlBarrierWaitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.execution_scope) attrs.append("execution_scope", prop.execution_scope); if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.memory_semantics) attrs.append("memory_semantics", prop.memory_semantics); } ::llvm::LogicalResult INTELControlBarrierWaitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getExecutionScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "execution_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemorySemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "memory_semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult INTELControlBarrierWaitOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.execution_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_semantics))) return ::mlir::failure(); return ::mlir::success(); } void INTELControlBarrierWaitOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.execution_scope); writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.memory_semantics); } ::mlir::spirv::Scope INTELControlBarrierWaitOp::getExecutionScope() { auto attr = getExecutionScopeAttr(); return attr.getValue(); } ::mlir::spirv::Scope INTELControlBarrierWaitOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics INTELControlBarrierWaitOp::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } void INTELControlBarrierWaitOp::setExecutionScope(::mlir::spirv::Scope attrValue) { getProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void INTELControlBarrierWaitOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void INTELControlBarrierWaitOp::setMemorySemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void INTELControlBarrierWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void INTELControlBarrierWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.getOrAddProperties().execution_scope = execution_scope; odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr execution_scope, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void INTELControlBarrierWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void INTELControlBarrierWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.getOrAddProperties().execution_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), execution_scope); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope execution_scope, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(execution_scope), std::forward(memory_scope), std::forward(memory_semantics)); } void INTELControlBarrierWaitOp::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(); ::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."); } } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELControlBarrierWaitOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELControlBarrierWaitOp INTELControlBarrierWaitOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELControlBarrierWaitOp::verifyInvariantsImpl() { auto tblgen_execution_scope = getProperties().execution_scope; (void)tblgen_execution_scope; if (!tblgen_execution_scope) return emitOpError("requires attribute 'execution_scope'"); auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitOpError("requires attribute 'memory_semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_execution_scope, "execution_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_memory_semantics, "memory_semantics"))) return ::mlir::failure(); return ::mlir::success(); } ::llvm::LogicalResult INTELControlBarrierWaitOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult INTELControlBarrierWaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr execution_scopeAttr; ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr memory_semanticsAttr; if (parser.parseCustomAttributeWithFallback(execution_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (execution_scopeAttr) result.getOrAddProperties().execution_scope = execution_scopeAttr; if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseCustomAttributeWithFallback(memory_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_semanticsAttr) result.getOrAddProperties().memory_semantics = memory_semanticsAttr; { 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 INTELControlBarrierWaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getExecutionScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemorySemanticsAttr()); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("execution_scope"); elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("memory_semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELControlBarrierWaitOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::INTELControlBarrierWaitOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELConvertBF16ToFOp definitions //===----------------------------------------------------------------------===// namespace detail { INTELConvertBF16ToFOpGenericAdaptorBase::INTELConvertBF16ToFOpGenericAdaptorBase(INTELConvertBF16ToFOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail INTELConvertBF16ToFOpAdaptor::INTELConvertBF16ToFOpAdaptor(INTELConvertBF16ToFOp op) : INTELConvertBF16ToFOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELConvertBF16ToFOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult INTELConvertBF16ToFOp::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 INTELConvertBF16ToFOp::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 INTELConvertBF16ToFOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional INTELConvertBF16ToFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void INTELConvertBF16ToFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void INTELConvertBF16ToFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult INTELConvertBF16ToFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void INTELConvertBF16ToFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } INTELConvertBF16ToFOp INTELConvertBF16ToFOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELConvertBF16ToFOp INTELConvertBF16ToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void INTELConvertBF16ToFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELConvertBF16ToFOp INTELConvertBF16ToFOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELConvertBF16ToFOp INTELConvertBF16ToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void INTELConvertBF16ToFOp::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); } INTELConvertBF16ToFOp INTELConvertBF16ToFOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELConvertBF16ToFOp INTELConvertBF16ToFOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELConvertBF16ToFOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELConvertBF16ToFOp INTELConvertBF16ToFOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELConvertBF16ToFOp INTELConvertBF16ToFOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELConvertBF16ToFOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps35(*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_SPIRVOps36(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult INTELConvertBF16ToFOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult INTELConvertBF16ToFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void INTELConvertBF16ToFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELConvertBF16ToFOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELConvertFToBF16Op definitions //===----------------------------------------------------------------------===// namespace detail { INTELConvertFToBF16OpGenericAdaptorBase::INTELConvertFToBF16OpGenericAdaptorBase(INTELConvertFToBF16Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail INTELConvertFToBF16OpAdaptor::INTELConvertFToBF16OpAdaptor(INTELConvertFToBF16Op op) : INTELConvertFToBF16OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELConvertFToBF16OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult INTELConvertFToBF16Op::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 INTELConvertFToBF16Op::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 INTELConvertFToBF16Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional INTELConvertFToBF16Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void INTELConvertFToBF16Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void INTELConvertFToBF16Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult INTELConvertFToBF16Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void INTELConvertFToBF16Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } INTELConvertFToBF16Op INTELConvertFToBF16Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELConvertFToBF16Op INTELConvertFToBF16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void INTELConvertFToBF16Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELConvertFToBF16Op INTELConvertFToBF16Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELConvertFToBF16Op INTELConvertFToBF16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void INTELConvertFToBF16Op::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); } INTELConvertFToBF16Op INTELConvertFToBF16Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELConvertFToBF16Op INTELConvertFToBF16Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELConvertFToBF16Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELConvertFToBF16Op INTELConvertFToBF16Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELConvertFToBF16Op INTELConvertFToBF16Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELConvertFToBF16Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps36(*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_SPIRVOps35(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult INTELConvertFToBF16Op::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult INTELConvertFToBF16Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void INTELConvertFToBF16Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELConvertFToBF16Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELMaskedGatherOp definitions //===----------------------------------------------------------------------===// namespace detail { INTELMaskedGatherOpGenericAdaptorBase::INTELMaskedGatherOpGenericAdaptorBase(INTELMaskedGatherOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail INTELMaskedGatherOpAdaptor::INTELMaskedGatherOpAdaptor(INTELMaskedGatherOp op) : INTELMaskedGatherOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELMaskedGatherOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult INTELMaskedGatherOp::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 INTELMaskedGatherOp::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 INTELMaskedGatherOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional INTELMaskedGatherOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void INTELMaskedGatherOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void INTELMaskedGatherOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult INTELMaskedGatherOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void INTELMaskedGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { odsState.addOperands(ptr_vector); odsState.addOperands(alignment); odsState.addOperands(mask); odsState.addOperands(fill_empty); odsState.addTypes(result); } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(fill_empty)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { return create(builder, builder.getLoc(), std::forward(result), std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(fill_empty)); } void INTELMaskedGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { odsState.addOperands(ptr_vector); odsState.addOperands(alignment); odsState.addOperands(mask); odsState.addOperands(fill_empty); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(INTELMaskedGatherOp::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); } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(fill_empty)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { return create(builder, builder.getLoc(), std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(fill_empty)); } void INTELMaskedGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { odsState.addOperands(ptr_vector); odsState.addOperands(alignment); odsState.addOperands(mask); odsState.addOperands(fill_empty); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(fill_empty)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value fill_empty) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(fill_empty)); } void INTELMaskedGatherOp::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); } INTELMaskedGatherOp INTELMaskedGatherOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELMaskedGatherOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(INTELMaskedGatherOp::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)."); } } INTELMaskedGatherOp INTELMaskedGatherOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void INTELMaskedGatherOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELMaskedGatherOp INTELMaskedGatherOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedGatherOp INTELMaskedGatherOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void INTELMaskedGatherOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(INTELMaskedGatherOp::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)."); } } INTELMaskedGatherOp INTELMaskedGatherOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedGatherOp INTELMaskedGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELMaskedGatherOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps37(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps27(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps3(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps38(*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_SPIRVOps38(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(3).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(3).begin()).getType())))) return emitOpError("failed to verify that all of {fill_empty, result} have same type"); if (!((std::equal_to<>()(VectorType::get(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType()).getPointeeType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that pointee type of ptr_vector must match result element type"); if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSResults(0).begin()).getType()), (*this->getODSOperands(2).begin()).getType())))) return emitOpError("failed to verify that mask must be a vector of i1 matching result shape"); return ::mlir::success(); } ::llvm::LogicalResult INTELMaskedGatherOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult INTELMaskedGatherOp::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() <= 3) return ::mlir::failure(); ::mlir::Type odsInferredType0 = operands[3].getType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult INTELMaskedGatherOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand ptr_vectorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptr_vectorOperands(&ptr_vectorRawOperand, 1); ::llvm::SMLoc ptr_vectorOperandsLoc; (void)ptr_vectorOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand alignmentRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> alignmentOperands(&alignmentRawOperand, 1); ::llvm::SMLoc alignmentOperandsLoc; (void)alignmentOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand maskRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(&maskRawOperand, 1); ::llvm::SMLoc maskOperandsLoc; (void)maskOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand fill_emptyRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> fill_emptyOperands(&fill_emptyRawOperand, 1); ::llvm::SMLoc fill_emptyOperandsLoc; (void)fill_emptyOperandsLoc; ::mlir::Type ptr_vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> ptr_vectorTypes(&ptr_vectorRawType, 1); ::mlir::Type alignmentRawType{}; ::llvm::ArrayRef<::mlir::Type> alignmentTypes(&alignmentRawType, 1); ::mlir::Type maskRawType{}; ::llvm::ArrayRef<::mlir::Type> maskTypes(&maskRawType, 1); ::mlir::Type fill_emptyRawType{}; ::llvm::ArrayRef<::mlir::Type> fill_emptyTypes(&fill_emptyRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); ptr_vectorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(ptr_vectorRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); alignmentOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(alignmentRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); maskOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(maskRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); fill_emptyOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(fill_emptyRawOperand)) 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(); ptr_vectorRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); alignmentRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); maskRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); fill_emptyRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(ptr_vectorOperands, ptr_vectorTypes, ptr_vectorOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(alignmentOperands, alignmentTypes, alignmentOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(fill_emptyOperands, fill_emptyTypes, fill_emptyOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void INTELMaskedGatherOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPtrVector(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getAlignment(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getMask(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getFillEmpty(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPtrVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getAlignment().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getMask().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getFillEmpty().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELMaskedGatherOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELMaskedScatterOp definitions //===----------------------------------------------------------------------===// namespace detail { INTELMaskedScatterOpGenericAdaptorBase::INTELMaskedScatterOpGenericAdaptorBase(INTELMaskedScatterOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail INTELMaskedScatterOpAdaptor::INTELMaskedScatterOpAdaptor(INTELMaskedScatterOp op) : INTELMaskedScatterOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELMaskedScatterOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult INTELMaskedScatterOp::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 INTELMaskedScatterOp::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 INTELMaskedScatterOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional INTELMaskedScatterOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void INTELMaskedScatterOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void INTELMaskedScatterOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult INTELMaskedScatterOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void INTELMaskedScatterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value input_vector) { odsState.addOperands(ptr_vector); odsState.addOperands(alignment); odsState.addOperands(mask); odsState.addOperands(input_vector); } INTELMaskedScatterOp INTELMaskedScatterOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value input_vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(input_vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedScatterOp INTELMaskedScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value input_vector) { return create(builder, builder.getLoc(), std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(input_vector)); } void INTELMaskedScatterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value input_vector) { odsState.addOperands(ptr_vector); odsState.addOperands(alignment); odsState.addOperands(mask); odsState.addOperands(input_vector); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELMaskedScatterOp INTELMaskedScatterOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value input_vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(input_vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedScatterOp INTELMaskedScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ptr_vector, ::mlir::Value alignment, ::mlir::Value mask, ::mlir::Value input_vector) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(ptr_vector), std::forward(alignment), std::forward(mask), std::forward(input_vector)); } void INTELMaskedScatterOp::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() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELMaskedScatterOp INTELMaskedScatterOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedScatterOp INTELMaskedScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELMaskedScatterOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELMaskedScatterOp INTELMaskedScatterOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELMaskedScatterOp INTELMaskedScatterOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELMaskedScatterOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps37(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps27(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps3(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps38(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(VectorType::get(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType()).getPointeeType()), (*this->getODSOperands(3).begin()).getType())))) return emitOpError("failed to verify that pointee type of ptr_vector must match input element type"); if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(3).begin()).getType()), (*this->getODSOperands(2).begin()).getType())))) return emitOpError("failed to verify that mask must be a vector of i1 matching input shape"); return ::mlir::success(); } ::llvm::LogicalResult INTELMaskedScatterOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult INTELMaskedScatterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand ptr_vectorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptr_vectorOperands(&ptr_vectorRawOperand, 1); ::llvm::SMLoc ptr_vectorOperandsLoc; (void)ptr_vectorOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand alignmentRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> alignmentOperands(&alignmentRawOperand, 1); ::llvm::SMLoc alignmentOperandsLoc; (void)alignmentOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand maskRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(&maskRawOperand, 1); ::llvm::SMLoc maskOperandsLoc; (void)maskOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input_vectorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_vectorOperands(&input_vectorRawOperand, 1); ::llvm::SMLoc input_vectorOperandsLoc; (void)input_vectorOperandsLoc; ::mlir::Type ptr_vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> ptr_vectorTypes(&ptr_vectorRawType, 1); ::mlir::Type alignmentRawType{}; ::llvm::ArrayRef<::mlir::Type> alignmentTypes(&alignmentRawType, 1); ::mlir::Type maskRawType{}; ::llvm::ArrayRef<::mlir::Type> maskTypes(&maskRawType, 1); ::mlir::Type input_vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> input_vectorTypes(&input_vectorRawType, 1); ptr_vectorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(ptr_vectorRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); alignmentOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(alignmentRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); maskOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(maskRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input_vectorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_vectorRawOperand)) 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(); ptr_vectorRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); alignmentRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); maskRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); input_vectorRawType = type; } if (parser.resolveOperands(ptr_vectorOperands, ptr_vectorTypes, ptr_vectorOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(alignmentOperands, alignmentTypes, alignmentOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(input_vectorOperands, input_vectorTypes, input_vectorOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void INTELMaskedScatterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPtrVector(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getAlignment(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getMask(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputVector(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPtrVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getAlignment().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getMask().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getInputVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELMaskedScatterOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELRoundFToTF32Op definitions //===----------------------------------------------------------------------===// namespace detail { INTELRoundFToTF32OpGenericAdaptorBase::INTELRoundFToTF32OpGenericAdaptorBase(INTELRoundFToTF32Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail INTELRoundFToTF32OpAdaptor::INTELRoundFToTF32OpAdaptor(INTELRoundFToTF32Op op) : INTELRoundFToTF32OpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELRoundFToTF32OpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult INTELRoundFToTF32Op::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 INTELRoundFToTF32Op::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 INTELRoundFToTF32Op::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional INTELRoundFToTF32Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void INTELRoundFToTF32Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void INTELRoundFToTF32Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult INTELRoundFToTF32Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void INTELRoundFToTF32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } INTELRoundFToTF32Op INTELRoundFToTF32Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELRoundFToTF32Op INTELRoundFToTF32Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void INTELRoundFToTF32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELRoundFToTF32Op INTELRoundFToTF32Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELRoundFToTF32Op INTELRoundFToTF32Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void INTELRoundFToTF32Op::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); } INTELRoundFToTF32Op INTELRoundFToTF32Op::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELRoundFToTF32Op INTELRoundFToTF32Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELRoundFToTF32Op::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELRoundFToTF32Op INTELRoundFToTF32Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELRoundFToTF32Op INTELRoundFToTF32Op::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELRoundFToTF32Op::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps36(*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_SPIRVOps36(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult INTELRoundFToTF32Op::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult INTELRoundFToTF32Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void INTELRoundFToTF32Op::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELRoundFToTF32Op) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELSubgroupBlockReadOp definitions //===----------------------------------------------------------------------===// namespace detail { INTELSubgroupBlockReadOpGenericAdaptorBase::INTELSubgroupBlockReadOpGenericAdaptorBase(INTELSubgroupBlockReadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail INTELSubgroupBlockReadOpAdaptor::INTELSubgroupBlockReadOpAdaptor(INTELSubgroupBlockReadOp op) : INTELSubgroupBlockReadOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELSubgroupBlockReadOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult INTELSubgroupBlockReadOp::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 INTELSubgroupBlockReadOp::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 INTELSubgroupBlockReadOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional INTELSubgroupBlockReadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void INTELSubgroupBlockReadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void INTELSubgroupBlockReadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult INTELSubgroupBlockReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void INTELSubgroupBlockReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value ptr) { odsState.addOperands(ptr); odsState.addTypes(value); } INTELSubgroupBlockReadOp INTELSubgroupBlockReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type value, ::mlir::Value ptr) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(value), std::forward(ptr)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELSubgroupBlockReadOp INTELSubgroupBlockReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type value, ::mlir::Value ptr) { return create(builder, builder.getLoc(), std::forward(value), std::forward(ptr)); } void INTELSubgroupBlockReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr) { odsState.addOperands(ptr); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELSubgroupBlockReadOp INTELSubgroupBlockReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ptr) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(ptr)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELSubgroupBlockReadOp INTELSubgroupBlockReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ptr) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(ptr)); } void INTELSubgroupBlockReadOp::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); } INTELSubgroupBlockReadOp INTELSubgroupBlockReadOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELSubgroupBlockReadOp INTELSubgroupBlockReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELSubgroupBlockReadOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELSubgroupBlockReadOp INTELSubgroupBlockReadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELSubgroupBlockReadOp INTELSubgroupBlockReadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELSubgroupBlockReadOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult INTELSubgroupBlockReadOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult INTELSubgroupBlockReadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(&ptrRawOperand, 1); ::llvm::SMLoc ptrOperandsLoc; (void)ptrOperandsLoc; ::mlir::Type ptrRawType{}; ::llvm::ArrayRef<::mlir::Type> ptrTypes(&ptrRawType, 1); ::mlir::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); ptrOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(ptrRawOperand)) 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(); ptrRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); valueRawType = type; } result.addTypes(valueTypes); if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void INTELSubgroupBlockReadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPtr(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPtr().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELSubgroupBlockReadOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INTELSubgroupBlockWriteOp definitions //===----------------------------------------------------------------------===// namespace detail { INTELSubgroupBlockWriteOpGenericAdaptorBase::INTELSubgroupBlockWriteOpGenericAdaptorBase(INTELSubgroupBlockWriteOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail INTELSubgroupBlockWriteOpAdaptor::INTELSubgroupBlockWriteOpAdaptor(INTELSubgroupBlockWriteOp op) : INTELSubgroupBlockWriteOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INTELSubgroupBlockWriteOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult INTELSubgroupBlockWriteOp::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 INTELSubgroupBlockWriteOp::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 INTELSubgroupBlockWriteOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional INTELSubgroupBlockWriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void INTELSubgroupBlockWriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void INTELSubgroupBlockWriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult INTELSubgroupBlockWriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void INTELSubgroupBlockWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value value) { odsState.addOperands(ptr); odsState.addOperands(value); } INTELSubgroupBlockWriteOp INTELSubgroupBlockWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value ptr, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(ptr), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELSubgroupBlockWriteOp INTELSubgroupBlockWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value ptr, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(ptr), std::forward(value)); } void INTELSubgroupBlockWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value value) { odsState.addOperands(ptr); odsState.addOperands(value); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } INTELSubgroupBlockWriteOp INTELSubgroupBlockWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(ptr), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELSubgroupBlockWriteOp INTELSubgroupBlockWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(ptr), std::forward(value)); } void INTELSubgroupBlockWriteOp::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); } INTELSubgroupBlockWriteOp INTELSubgroupBlockWriteOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELSubgroupBlockWriteOp INTELSubgroupBlockWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INTELSubgroupBlockWriteOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INTELSubgroupBlockWriteOp INTELSubgroupBlockWriteOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INTELSubgroupBlockWriteOp INTELSubgroupBlockWriteOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INTELSubgroupBlockWriteOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps12(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult INTELSubgroupBlockWriteOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult INTELSubgroupBlockWriteOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INTELSubgroupBlockWriteOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::INotEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { INotEqualOpGenericAdaptorBase::INotEqualOpGenericAdaptorBase(INotEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail INotEqualOpAdaptor::INotEqualOpAdaptor(INotEqualOp op) : INotEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult INotEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult INotEqualOp::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 INotEqualOp::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 INotEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional INotEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void INotEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void INotEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult INotEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void INotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } INotEqualOp INotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INotEqualOp INotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void INotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(INotEqualOp::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); } INotEqualOp INotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INotEqualOp INotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void INotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } INotEqualOp INotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INotEqualOp INotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void INotEqualOp::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); } INotEqualOp INotEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INotEqualOp INotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void INotEqualOp::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(INotEqualOp::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)."); } } INotEqualOp INotEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INotEqualOp INotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void INotEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } INotEqualOp INotEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INotEqualOp INotEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void INotEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(INotEqualOp::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)."); } } INotEqualOp INotEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } INotEqualOp INotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult INotEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult INotEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult INotEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult INotEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void INotEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void INotEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::INotEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ISubBorrowOp definitions //===----------------------------------------------------------------------===// namespace detail { ISubBorrowOpGenericAdaptorBase::ISubBorrowOpGenericAdaptorBase(ISubBorrowOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ISubBorrowOpAdaptor::ISubBorrowOpAdaptor(ISubBorrowOp op) : ISubBorrowOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ISubBorrowOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ISubBorrowOp::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 ISubBorrowOp::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 ISubBorrowOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ISubBorrowOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ISubBorrowOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ISubBorrowOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ISubBorrowOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ISubBorrowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value operand1, Value operand2) { build(odsBuilder, odsState, ::mlir::spirv::StructType::get({operand1.getType(), operand1.getType()}), operand1, operand2); } ISubBorrowOp ISubBorrowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value operand1, Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubBorrowOp ISubBorrowOp::create(::mlir::ImplicitLocOpBuilder &builder, Value operand1, Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void ISubBorrowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } ISubBorrowOp ISubBorrowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubBorrowOp ISubBorrowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void ISubBorrowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ISubBorrowOp ISubBorrowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubBorrowOp ISubBorrowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void ISubBorrowOp::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); } ISubBorrowOp ISubBorrowOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubBorrowOp ISubBorrowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ISubBorrowOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ISubBorrowOp ISubBorrowOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubBorrowOp ISubBorrowOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ISubBorrowOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps25(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ISubBorrowOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult ISubBorrowOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void ISubBorrowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ISubBorrowOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ISubOp definitions //===----------------------------------------------------------------------===// namespace detail { ISubOpGenericAdaptorBase::ISubOpGenericAdaptorBase(ISubOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ISubOpAdaptor::ISubOpAdaptor(ISubOp op) : ISubOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ISubOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ISubOp::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 ISubOp::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 ISubOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ISubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ISubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ISubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ISubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } ISubOp ISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubOp ISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void ISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ISubOp::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); } ISubOp ISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubOp ISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void ISubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ISubOp ISubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubOp ISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void ISubOp::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); } ISubOp ISubOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubOp ISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ISubOp::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(ISubOp::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)."); } } ISubOp ISubOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubOp ISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void ISubOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ISubOp ISubOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubOp ISubOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void ISubOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ISubOp::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)."); } } ISubOp ISubOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ISubOp ISubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ISubOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps14(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult ISubOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult ISubOp::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 ISubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ISubOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 ISubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ISubOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageDrefGatherOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageDrefGatherOpGenericAdaptorBase::ImageDrefGatherOpGenericAdaptorBase(ImageDrefGatherOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair ImageDrefGatherOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {false, 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 - 3) / 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}; } ::std::optional<::mlir::spirv::ImageOperands> ImageDrefGatherOpGenericAdaptorBase::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } } // namespace detail ImageDrefGatherOpAdaptor::ImageDrefGatherOpAdaptor(ImageDrefGatherOp op) : ImageDrefGatherOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageDrefGatherOpAdaptor::verify(::mlir::Location loc) { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (tblgen_image_operands && !((::llvm::isa<::mlir::spirv::ImageOperandsAttr>(tblgen_image_operands)))) return emitError(loc, "'spirv.ImageDrefGather' op attribute 'image_operands' failed to satisfy constraint: valid SPIR-V ImageOperands"); return ::mlir::success(); } std::pair ImageDrefGatherOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {false, 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() - 3) / 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 ImageDrefGatherOp::getOperandArgumentsMutable() { auto range = getODSOperandIndexAndLength(3); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult ImageDrefGatherOp::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.image_operands; auto attr = dict.get("image_operands"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `image_operands` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ImageDrefGatherOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.image_operands; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("image_operands", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ImageDrefGatherOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.image_operands.getAsOpaquePointer())); } std::optional ImageDrefGatherOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "image_operands") return prop.image_operands; return std::nullopt; } void ImageDrefGatherOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "image_operands") { prop.image_operands = ::llvm::dyn_cast_or_null>(value); return; } } void ImageDrefGatherOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.image_operands) attrs.append("image_operands", prop.image_operands); } ::llvm::LogicalResult ImageDrefGatherOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getImageOperandsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(attr, "image_operands", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ImageDrefGatherOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.image_operands))) return ::mlir::failure(); return ::mlir::success(); } void ImageDrefGatherOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.image_operands); } ::std::optional<::mlir::spirv::ImageOperands> ImageDrefGatherOp::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } void ImageDrefGatherOp::setImageOperands(::std::optional<::mlir::spirv::ImageOperands> attrValue) { auto &odsProp = getProperties().image_operands; if (attrValue) odsProp = ::mlir::spirv::ImageOperandsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void ImageDrefGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(dref); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } odsState.addTypes(result); } ImageDrefGatherOp ImageDrefGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageDrefGatherOp ImageDrefGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); } void ImageDrefGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(dref); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageDrefGatherOp ImageDrefGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageDrefGatherOp ImageDrefGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); } void ImageDrefGatherOp::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(); ::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."); } } ImageDrefGatherOp ImageDrefGatherOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageDrefGatherOp ImageDrefGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageDrefGatherOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageDrefGatherOp ImageDrefGatherOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageDrefGatherOp ImageDrefGatherOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageDrefGatherOp::verifyInvariantsImpl() { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(*this, tblgen_image_operands, "image_operands"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps39(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps40(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*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_SPIRVOps41(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::Dim::Dim2D, ::mlir::spirv::Dim::Cube, ::mlir::spirv::Dim::Rect},::llvm::cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getDim())))) return emitOpError("failed to verify that the Dim operand of the underlying image must be Dim2D or Cube or Rect"); if (!((::llvm::is_contained({::mlir::spirv::ImageSamplingInfo::SingleSampled},::llvm::cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getSamplingInfo())))) return emitOpError("failed to verify that the MS operand of the underlying image type must be SingleSampled"); if (!((::llvm::isa(cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getElementType()) ||(getElementTypeOrSelf((*this->getODSResults(0).begin()))==cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getElementType())))) return emitOpError("failed to verify that the result component type must match the image sampled type"); return ::mlir::success(); } ::llvm::LogicalResult ImageDrefGatherOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ImageDrefGatherOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand sampled_imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sampled_imageOperands(&sampled_imageRawOperand, 1); ::llvm::SMLoc sampled_imageOperandsLoc; (void)sampled_imageOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand coordinateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coordinateOperands(&coordinateRawOperand, 1); ::llvm::SMLoc coordinateOperandsLoc; (void)coordinateOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand drefRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> drefOperands(&drefRawOperand, 1); ::llvm::SMLoc drefOperandsLoc; (void)drefOperandsLoc; ::mlir::spirv::ImageOperandsAttr image_operandsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operand_argumentsOperands; ::llvm::SMLoc operand_argumentsOperandsLoc; (void)operand_argumentsOperandsLoc; ::mlir::Type sampled_imageRawType{}; ::llvm::ArrayRef<::mlir::Type> sampled_imageTypes(&sampled_imageRawType, 1); ::mlir::Type coordinateRawType{}; ::llvm::ArrayRef<::mlir::Type> coordinateTypes(&coordinateRawType, 1); ::mlir::Type drefRawType{}; ::llvm::ArrayRef<::mlir::Type> drefTypes(&drefRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> operand_argumentsTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); sampled_imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(sampled_imageRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); coordinateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(coordinateRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); drefOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(drefRawOperand)) return ::mlir::failure(); { auto odsResult = parseImageOperands(parser, image_operandsAttr); if (odsResult) return ::mlir::failure(); if (image_operandsAttr) result.getOrAddProperties().image_operands = image_operandsAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { operand_argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(operand_argumentsOperands)) 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(); sampled_imageRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); coordinateRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::FloatType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); drefRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseTypeList(operand_argumentsTypes)) return ::mlir::failure(); } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(sampled_imageOperands, sampled_imageTypes, sampled_imageOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(coordinateOperands, coordinateTypes, coordinateOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(drefOperands, drefTypes, drefOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand_argumentsOperands, operand_argumentsTypes, operand_argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageDrefGatherOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getSampledImage(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getCoordinate(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getDref(); _odsPrinter << ' '; printImageOperands(_odsPrinter, *this, getImageOperandsAttr()); if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments(); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("image_operands"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getSampledImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getCoordinate().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getDref().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ImageDrefGatherOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageDrefGatherOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ImageDrefGatherOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageFetchOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageFetchOpGenericAdaptorBase::ImageFetchOpGenericAdaptorBase(ImageFetchOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair ImageFetchOpGenericAdaptorBase::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}; } ::std::optional<::mlir::spirv::ImageOperands> ImageFetchOpGenericAdaptorBase::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } } // namespace detail ImageFetchOpAdaptor::ImageFetchOpAdaptor(ImageFetchOp op) : ImageFetchOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageFetchOpAdaptor::verify(::mlir::Location loc) { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (tblgen_image_operands && !((::llvm::isa<::mlir::spirv::ImageOperandsAttr>(tblgen_image_operands)))) return emitError(loc, "'spirv.ImageFetch' op attribute 'image_operands' failed to satisfy constraint: valid SPIR-V ImageOperands"); return ::mlir::success(); } std::pair ImageFetchOp::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 ImageFetchOp::getOperandArgumentsMutable() { auto range = getODSOperandIndexAndLength(2); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult ImageFetchOp::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.image_operands; auto attr = dict.get("image_operands"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `image_operands` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ImageFetchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.image_operands; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("image_operands", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ImageFetchOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.image_operands.getAsOpaquePointer())); } std::optional ImageFetchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "image_operands") return prop.image_operands; return std::nullopt; } void ImageFetchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "image_operands") { prop.image_operands = ::llvm::dyn_cast_or_null>(value); return; } } void ImageFetchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.image_operands) attrs.append("image_operands", prop.image_operands); } ::llvm::LogicalResult ImageFetchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getImageOperandsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(attr, "image_operands", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ImageFetchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.image_operands))) return ::mlir::failure(); return ::mlir::success(); } void ImageFetchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.image_operands); } ::std::optional<::mlir::spirv::ImageOperands> ImageFetchOp::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } void ImageFetchOp::setImageOperands(::std::optional<::mlir::spirv::ImageOperands> attrValue) { auto &odsProp = getProperties().image_operands; if (attrValue) odsProp = ::mlir::spirv::ImageOperandsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void ImageFetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } odsState.addTypes(result); } ImageFetchOp ImageFetchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageFetchOp ImageFetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(result), std::forward(image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageFetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageFetchOp ImageFetchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageFetchOp ImageFetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageFetchOp::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(); ::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."); } } ImageFetchOp ImageFetchOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageFetchOp ImageFetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageFetchOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageFetchOp ImageFetchOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageFetchOp ImageFetchOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageFetchOp::verifyInvariantsImpl() { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(*this, tblgen_image_operands, "image_operands"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps42(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*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_SPIRVOps43(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(!((::llvm::is_contained({::mlir::spirv::Dim::Cube},::llvm::cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getDim()))))) return emitOpError("failed to verify that the Dim operand of the underlying image must not be Cube"); if (!((::llvm::is_contained({::mlir::spirv::ImageSamplerUseInfo::NeedSampler},::llvm::cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getSamplerUseInfo())))) return emitOpError("failed to verify that the sampled operand of the underlying image must be NeedSampler"); if (!((::llvm::isa(cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getElementType()) ||(getElementTypeOrSelf((*this->getODSResults(0).begin()))==cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getElementType())))) return emitOpError("failed to verify that the result component type must match the image sampled type"); return ::mlir::success(); } ::llvm::LogicalResult ImageFetchOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ImageFetchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> imageOperands(&imageRawOperand, 1); ::llvm::SMLoc imageOperandsLoc; (void)imageOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand coordinateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coordinateOperands(&coordinateRawOperand, 1); ::llvm::SMLoc coordinateOperandsLoc; (void)coordinateOperandsLoc; ::mlir::spirv::ImageOperandsAttr image_operandsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operand_argumentsOperands; ::llvm::SMLoc operand_argumentsOperandsLoc; (void)operand_argumentsOperandsLoc; ::mlir::Type imageRawType{}; ::llvm::ArrayRef<::mlir::Type> imageTypes(&imageRawType, 1); ::mlir::Type coordinateRawType{}; ::llvm::ArrayRef<::mlir::Type> coordinateTypes(&coordinateRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> operand_argumentsTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(imageRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); coordinateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(coordinateRawOperand)) return ::mlir::failure(); { auto odsResult = parseImageOperands(parser, image_operandsAttr); if (odsResult) return ::mlir::failure(); if (image_operandsAttr) result.getOrAddProperties().image_operands = image_operandsAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { operand_argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(operand_argumentsOperands)) 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(); imageRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); coordinateRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseTypeList(operand_argumentsTypes)) return ::mlir::failure(); } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(imageOperands, imageTypes, imageOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(coordinateOperands, coordinateTypes, coordinateOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand_argumentsOperands, operand_argumentsTypes, operand_argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageFetchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getImage(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getCoordinate(); _odsPrinter << ' '; printImageOperands(_odsPrinter, *this, getImageOperandsAttr()); if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments(); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("image_operands"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getCoordinate().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageFetchOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ImageFetchOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageOpGenericAdaptorBase::ImageOpGenericAdaptorBase(ImageOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ImageOpAdaptor::ImageOpAdaptor(ImageOp op) : ImageOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ImageOp::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 ImageOp::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 ImageOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ImageOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ImageOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ImageOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ImageOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ImageOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value sampled_image) { odsState.addOperands(sampled_image); odsState.addTypes(result); } ImageOp ImageOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value sampled_image) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(sampled_image)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageOp ImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value sampled_image) { return create(builder, builder.getLoc(), std::forward(result), std::forward(sampled_image)); } void ImageOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value sampled_image) { odsState.addOperands(sampled_image); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ImageOp::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); } ImageOp ImageOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value sampled_image) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(sampled_image)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageOp ImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value sampled_image) { return create(builder, builder.getLoc(), std::forward(sampled_image)); } void ImageOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image) { odsState.addOperands(sampled_image); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageOp ImageOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(sampled_image)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageOp ImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(sampled_image)); } void ImageOp::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); } ImageOp ImageOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageOp ImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageOp::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(ImageOp::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)."); } } ImageOp ImageOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageOp ImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void ImageOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageOp ImageOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageOp ImageOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void ImageOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ImageOp::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)."); } } ImageOp ImageOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageOp ImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps39(*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_SPIRVOps42(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getImageType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of 'result' matches image type of 'sampled_image'"); return ::mlir::success(); } ::llvm::LogicalResult ImageOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult ImageOp::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 = ::llvm::cast(operands[0].getType()).getImageType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult ImageOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand sampled_imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sampled_imageOperands(&sampled_imageRawOperand, 1); ::llvm::SMLoc sampled_imageOperandsLoc; (void)sampled_imageOperandsLoc; ::mlir::Type sampled_imageRawType{}; ::llvm::ArrayRef<::mlir::Type> sampled_imageTypes(&sampled_imageRawType, 1); sampled_imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(sampled_imageRawOperand)) 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(); sampled_imageRawType = type; } for (::mlir::Type type : sampled_imageTypes) { (void)type; if (!((::llvm::isa<::mlir::spirv::SampledImageType>(type)))) { return parser.emitError(parser.getNameLoc()) << "'sampled_image' must be any SPIR-V sampled image type, but got " << type; } } result.addTypes(::llvm::cast(sampled_imageTypes[0]).getImageType()); if (parser.resolveOperands(sampled_imageOperands, sampled_imageTypes, sampled_imageOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getSampledImage(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getSampledImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ImageOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageQuerySizeOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageQuerySizeOpGenericAdaptorBase::ImageQuerySizeOpGenericAdaptorBase(ImageQuerySizeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ImageQuerySizeOpAdaptor::ImageQuerySizeOpAdaptor(ImageQuerySizeOp op) : ImageQuerySizeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageQuerySizeOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ImageQuerySizeOp::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 ImageQuerySizeOp::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 ImageQuerySizeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ImageQuerySizeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ImageQuerySizeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ImageQuerySizeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ImageQuerySizeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ImageQuerySizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value image) { odsState.addOperands(image); odsState.addTypes(result); } ImageQuerySizeOp ImageQuerySizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value image) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(image)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageQuerySizeOp ImageQuerySizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value image) { return create(builder, builder.getLoc(), std::forward(result), std::forward(image)); } void ImageQuerySizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image) { odsState.addOperands(image); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageQuerySizeOp ImageQuerySizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value image) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(image)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageQuerySizeOp ImageQuerySizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value image) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(image)); } void ImageQuerySizeOp::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); } ImageQuerySizeOp ImageQuerySizeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageQuerySizeOp ImageQuerySizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageQuerySizeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageQuerySizeOp ImageQuerySizeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageQuerySizeOp ImageQuerySizeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageQuerySizeOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps42(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ImageQuerySizeOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ImageQuerySizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> imageOperands(&imageRawOperand, 1); ::llvm::SMLoc imageOperandsLoc; (void)imageOperandsLoc; ::mlir::Type imageRawType{}; ::llvm::ArrayRef<::mlir::Type> imageTypes(&imageRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(imageRawOperand)) 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(); imageRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(imageOperands, imageTypes, imageOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageQuerySizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getImage(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 ImageQuerySizeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageQuerySizeOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageReadOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageReadOpGenericAdaptorBase::ImageReadOpGenericAdaptorBase(ImageReadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair ImageReadOpGenericAdaptorBase::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}; } ::std::optional<::mlir::spirv::ImageOperands> ImageReadOpGenericAdaptorBase::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } } // namespace detail ImageReadOpAdaptor::ImageReadOpAdaptor(ImageReadOp op) : ImageReadOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageReadOpAdaptor::verify(::mlir::Location loc) { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (tblgen_image_operands && !((::llvm::isa<::mlir::spirv::ImageOperandsAttr>(tblgen_image_operands)))) return emitError(loc, "'spirv.ImageRead' op attribute 'image_operands' failed to satisfy constraint: valid SPIR-V ImageOperands"); return ::mlir::success(); } std::pair ImageReadOp::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 ImageReadOp::getOperandArgumentsMutable() { auto range = getODSOperandIndexAndLength(2); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult ImageReadOp::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.image_operands; auto attr = dict.get("image_operands"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `image_operands` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ImageReadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.image_operands; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("image_operands", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ImageReadOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.image_operands.getAsOpaquePointer())); } std::optional ImageReadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "image_operands") return prop.image_operands; return std::nullopt; } void ImageReadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "image_operands") { prop.image_operands = ::llvm::dyn_cast_or_null>(value); return; } } void ImageReadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.image_operands) attrs.append("image_operands", prop.image_operands); } ::llvm::LogicalResult ImageReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getImageOperandsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(attr, "image_operands", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ImageReadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.image_operands))) return ::mlir::failure(); return ::mlir::success(); } void ImageReadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.image_operands); } ::std::optional<::mlir::spirv::ImageOperands> ImageReadOp::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } void ImageReadOp::setImageOperands(::std::optional<::mlir::spirv::ImageOperands> attrValue) { auto &odsProp = getProperties().image_operands; if (attrValue) odsProp = ::mlir::spirv::ImageOperandsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void ImageReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } odsState.addTypes(result); } ImageReadOp ImageReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageReadOp ImageReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(result), std::forward(image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageReadOp ImageReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageReadOp ImageReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageReadOp::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(); ::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."); } } ImageReadOp ImageReadOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageReadOp ImageReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageReadOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageReadOp ImageReadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageReadOp ImageReadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageReadOp::verifyInvariantsImpl() { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(*this, tblgen_image_operands, "image_operands"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps42(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps44(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*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_SPIRVOps44(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::ImageSamplerUseInfo::SamplerUnknown, ::mlir::spirv::ImageSamplerUseInfo::NoSampler},::llvm::cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getSamplerUseInfo())))) return emitOpError("failed to verify that the sampled operand of the underlying image must be SamplerUnknown or NoSampler"); if (!((::llvm::isa(cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getElementType()) ||(getElementTypeOrSelf((*this->getODSResults(0).begin()))==cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getElementType())))) return emitOpError("failed to verify that the result component type must match the image sampled type"); return ::mlir::success(); } ::llvm::LogicalResult ImageReadOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ImageReadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> imageOperands(&imageRawOperand, 1); ::llvm::SMLoc imageOperandsLoc; (void)imageOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand coordinateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coordinateOperands(&coordinateRawOperand, 1); ::llvm::SMLoc coordinateOperandsLoc; (void)coordinateOperandsLoc; ::mlir::spirv::ImageOperandsAttr image_operandsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operand_argumentsOperands; ::llvm::SMLoc operand_argumentsOperandsLoc; (void)operand_argumentsOperandsLoc; ::mlir::Type imageRawType{}; ::llvm::ArrayRef<::mlir::Type> imageTypes(&imageRawType, 1); ::mlir::Type coordinateRawType{}; ::llvm::ArrayRef<::mlir::Type> coordinateTypes(&coordinateRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> operand_argumentsTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(imageRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); coordinateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(coordinateRawOperand)) return ::mlir::failure(); { auto odsResult = parseImageOperands(parser, image_operandsAttr); if (odsResult) return ::mlir::failure(); if (image_operandsAttr) result.getOrAddProperties().image_operands = image_operandsAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { operand_argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(operand_argumentsOperands)) 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(); imageRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); coordinateRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseTypeList(operand_argumentsTypes)) return ::mlir::failure(); } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(imageOperands, imageTypes, imageOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(coordinateOperands, coordinateTypes, coordinateOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand_argumentsOperands, operand_argumentsTypes, operand_argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageReadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getImage(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getCoordinate(); _odsPrinter << ' '; printImageOperands(_odsPrinter, *this, getImageOperandsAttr()); if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments(); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("image_operands"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getCoordinate().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageReadOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ImageReadOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageSampleExplicitLodOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageSampleExplicitLodOpGenericAdaptorBase::ImageSampleExplicitLodOpGenericAdaptorBase(ImageSampleExplicitLodOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair ImageSampleExplicitLodOpGenericAdaptorBase::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}; } ::mlir::spirv::ImageOperands ImageSampleExplicitLodOpGenericAdaptorBase::getImageOperands() { auto attr = getImageOperandsAttr(); return attr.getValue(); } } // namespace detail ImageSampleExplicitLodOpAdaptor::ImageSampleExplicitLodOpAdaptor(ImageSampleExplicitLodOp op) : ImageSampleExplicitLodOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageSampleExplicitLodOpAdaptor::verify(::mlir::Location loc) { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (!tblgen_image_operands) return emitError(loc, "'spirv.ImageSampleExplicitLod' op requires attribute 'image_operands'"); if (tblgen_image_operands && !((::llvm::isa<::mlir::spirv::ImageOperandsAttr>(tblgen_image_operands)))) return emitError(loc, "'spirv.ImageSampleExplicitLod' op attribute 'image_operands' failed to satisfy constraint: valid SPIR-V ImageOperands"); return ::mlir::success(); } std::pair ImageSampleExplicitLodOp::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 ImageSampleExplicitLodOp::getOperandArgumentsMutable() { auto range = getODSOperandIndexAndLength(2); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult ImageSampleExplicitLodOp::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.image_operands; auto attr = dict.get("image_operands"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `image_operands` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ImageSampleExplicitLodOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.image_operands; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("image_operands", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ImageSampleExplicitLodOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.image_operands.getAsOpaquePointer())); } std::optional ImageSampleExplicitLodOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "image_operands") return prop.image_operands; return std::nullopt; } void ImageSampleExplicitLodOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "image_operands") { prop.image_operands = ::llvm::dyn_cast_or_null>(value); return; } } void ImageSampleExplicitLodOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.image_operands) attrs.append("image_operands", prop.image_operands); } ::llvm::LogicalResult ImageSampleExplicitLodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getImageOperandsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(attr, "image_operands", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ImageSampleExplicitLodOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.image_operands))) return ::mlir::failure(); return ::mlir::success(); } void ImageSampleExplicitLodOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.image_operands); } ::mlir::spirv::ImageOperands ImageSampleExplicitLodOp::getImageOperands() { auto attr = getImageOperandsAttr(); return attr.getValue(); } void ImageSampleExplicitLodOp::setImageOperands(::mlir::spirv::ImageOperands attrValue) { getProperties().image_operands = ::mlir::spirv::ImageOperandsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ImageSampleExplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); odsState.getOrAddProperties().image_operands = image_operands; odsState.addTypes(result); } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleExplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); odsState.getOrAddProperties().image_operands = image_operands; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleExplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperands image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); odsState.getOrAddProperties().image_operands = ::mlir::spirv::ImageOperandsAttr::get(odsBuilder.getContext(), image_operands); odsState.addTypes(result); } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperands image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperands image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleExplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperands image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); odsState.getOrAddProperties().image_operands = ::mlir::spirv::ImageOperandsAttr::get(odsBuilder.getContext(), image_operands); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperands image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::spirv::ImageOperands image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleExplicitLodOp::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(); ::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."); } } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageSampleExplicitLodOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleExplicitLodOp ImageSampleExplicitLodOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageSampleExplicitLodOp::verifyInvariantsImpl() { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (!tblgen_image_operands) return emitOpError("requires attribute 'image_operands'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(*this, tblgen_image_operands, "image_operands"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps39(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps44(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*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_SPIRVOps41(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(!((::llvm::is_contained({::mlir::spirv::Dim::Buffer},::llvm::cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getDim()))))) return emitOpError("failed to verify that the Dim operand of the underlying image must not be Buffer"); if (!((::llvm::is_contained({::mlir::spirv::ImageSamplingInfo::SingleSampled},::llvm::cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getSamplingInfo())))) return emitOpError("failed to verify that the MS operand of the underlying image type must be SingleSampled"); if (!((::llvm::isa(cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getElementType()) ||(getElementTypeOrSelf((*this->getODSResults(0).begin()))==cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getElementType())))) return emitOpError("failed to verify that the result component type must match the image sampled type"); if (!((::mlir::spirv::bitEnumContainsAny(getImageOperands(), ::mlir::spirv::ImageOperands::Lod | ::mlir::spirv::ImageOperands::Grad)))) return emitOpError("failed to verify that either Lod or Grad image operands must be present"); return ::mlir::success(); } ::llvm::LogicalResult ImageSampleExplicitLodOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ImageSampleExplicitLodOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand sampled_imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sampled_imageOperands(&sampled_imageRawOperand, 1); ::llvm::SMLoc sampled_imageOperandsLoc; (void)sampled_imageOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand coordinateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coordinateOperands(&coordinateRawOperand, 1); ::llvm::SMLoc coordinateOperandsLoc; (void)coordinateOperandsLoc; ::mlir::spirv::ImageOperandsAttr image_operandsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operand_argumentsOperands; ::llvm::SMLoc operand_argumentsOperandsLoc; (void)operand_argumentsOperandsLoc; ::mlir::Type sampled_imageRawType{}; ::llvm::ArrayRef<::mlir::Type> sampled_imageTypes(&sampled_imageRawType, 1); ::mlir::Type coordinateRawType{}; ::llvm::ArrayRef<::mlir::Type> coordinateTypes(&coordinateRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> operand_argumentsTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); sampled_imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(sampled_imageRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); coordinateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(coordinateRawOperand)) return ::mlir::failure(); { auto odsResult = parseImageOperands(parser, image_operandsAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().image_operands = image_operandsAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { operand_argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(operand_argumentsOperands)) 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(); sampled_imageRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); coordinateRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseTypeList(operand_argumentsTypes)) return ::mlir::failure(); } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(sampled_imageOperands, sampled_imageTypes, sampled_imageOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(coordinateOperands, coordinateTypes, coordinateOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand_argumentsOperands, operand_argumentsTypes, operand_argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageSampleExplicitLodOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getSampledImage(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getCoordinate(); _odsPrinter << ' '; printImageOperands(_odsPrinter, *this, getImageOperandsAttr()); if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments(); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("image_operands"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getSampledImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getCoordinate().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageSampleExplicitLodOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ImageSampleExplicitLodOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageSampleImplicitLodOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageSampleImplicitLodOpGenericAdaptorBase::ImageSampleImplicitLodOpGenericAdaptorBase(ImageSampleImplicitLodOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair ImageSampleImplicitLodOpGenericAdaptorBase::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}; } ::std::optional<::mlir::spirv::ImageOperands> ImageSampleImplicitLodOpGenericAdaptorBase::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } } // namespace detail ImageSampleImplicitLodOpAdaptor::ImageSampleImplicitLodOpAdaptor(ImageSampleImplicitLodOp op) : ImageSampleImplicitLodOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageSampleImplicitLodOpAdaptor::verify(::mlir::Location loc) { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (tblgen_image_operands && !((::llvm::isa<::mlir::spirv::ImageOperandsAttr>(tblgen_image_operands)))) return emitError(loc, "'spirv.ImageSampleImplicitLod' op attribute 'image_operands' failed to satisfy constraint: valid SPIR-V ImageOperands"); return ::mlir::success(); } std::pair ImageSampleImplicitLodOp::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 ImageSampleImplicitLodOp::getOperandArgumentsMutable() { auto range = getODSOperandIndexAndLength(2); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult ImageSampleImplicitLodOp::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.image_operands; auto attr = dict.get("image_operands"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `image_operands` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ImageSampleImplicitLodOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.image_operands; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("image_operands", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ImageSampleImplicitLodOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.image_operands.getAsOpaquePointer())); } std::optional ImageSampleImplicitLodOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "image_operands") return prop.image_operands; return std::nullopt; } void ImageSampleImplicitLodOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "image_operands") { prop.image_operands = ::llvm::dyn_cast_or_null>(value); return; } } void ImageSampleImplicitLodOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.image_operands) attrs.append("image_operands", prop.image_operands); } ::llvm::LogicalResult ImageSampleImplicitLodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getImageOperandsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(attr, "image_operands", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ImageSampleImplicitLodOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.image_operands))) return ::mlir::failure(); return ::mlir::success(); } void ImageSampleImplicitLodOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.image_operands); } ::std::optional<::mlir::spirv::ImageOperands> ImageSampleImplicitLodOp::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } void ImageSampleImplicitLodOp::setImageOperands(::std::optional<::mlir::spirv::ImageOperands> attrValue) { auto &odsProp = getProperties().image_operands; if (attrValue) odsProp = ::mlir::spirv::ImageOperandsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void ImageSampleImplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } odsState.addTypes(result); } ImageSampleImplicitLodOp ImageSampleImplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleImplicitLodOp ImageSampleImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleImplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageSampleImplicitLodOp ImageSampleImplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleImplicitLodOp ImageSampleImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleImplicitLodOp::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(); ::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."); } } ImageSampleImplicitLodOp ImageSampleImplicitLodOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleImplicitLodOp ImageSampleImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageSampleImplicitLodOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageSampleImplicitLodOp ImageSampleImplicitLodOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleImplicitLodOp ImageSampleImplicitLodOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageSampleImplicitLodOp::verifyInvariantsImpl() { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(*this, tblgen_image_operands, "image_operands"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps39(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*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_SPIRVOps41(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(!((::llvm::is_contained({::mlir::spirv::Dim::Buffer},::llvm::cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getDim()))))) return emitOpError("failed to verify that the Dim operand of the underlying image must not be Buffer"); if (!((::llvm::is_contained({::mlir::spirv::ImageSamplingInfo::SingleSampled},::llvm::cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getSamplingInfo())))) return emitOpError("failed to verify that the MS operand of the underlying image type must be SingleSampled"); if (!((::llvm::isa(cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getElementType()) ||(getElementTypeOrSelf((*this->getODSResults(0).begin()))==cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getElementType())))) return emitOpError("failed to verify that the result component type must match the image sampled type"); return ::mlir::success(); } ::llvm::LogicalResult ImageSampleImplicitLodOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ImageSampleImplicitLodOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand sampled_imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sampled_imageOperands(&sampled_imageRawOperand, 1); ::llvm::SMLoc sampled_imageOperandsLoc; (void)sampled_imageOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand coordinateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coordinateOperands(&coordinateRawOperand, 1); ::llvm::SMLoc coordinateOperandsLoc; (void)coordinateOperandsLoc; ::mlir::spirv::ImageOperandsAttr image_operandsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operand_argumentsOperands; ::llvm::SMLoc operand_argumentsOperandsLoc; (void)operand_argumentsOperandsLoc; ::mlir::Type sampled_imageRawType{}; ::llvm::ArrayRef<::mlir::Type> sampled_imageTypes(&sampled_imageRawType, 1); ::mlir::Type coordinateRawType{}; ::llvm::ArrayRef<::mlir::Type> coordinateTypes(&coordinateRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> operand_argumentsTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); sampled_imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(sampled_imageRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); coordinateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(coordinateRawOperand)) return ::mlir::failure(); { auto odsResult = parseImageOperands(parser, image_operandsAttr); if (odsResult) return ::mlir::failure(); if (image_operandsAttr) result.getOrAddProperties().image_operands = image_operandsAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { operand_argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(operand_argumentsOperands)) 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(); sampled_imageRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); coordinateRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseTypeList(operand_argumentsTypes)) return ::mlir::failure(); } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(sampled_imageOperands, sampled_imageTypes, sampled_imageOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(coordinateOperands, coordinateTypes, coordinateOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand_argumentsOperands, operand_argumentsTypes, operand_argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageSampleImplicitLodOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getSampledImage(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getCoordinate(); _odsPrinter << ' '; printImageOperands(_odsPrinter, *this, getImageOperandsAttr()); if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments(); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("image_operands"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getSampledImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getCoordinate().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageSampleImplicitLodOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ImageSampleImplicitLodOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageSampleProjDrefImplicitLodOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageSampleProjDrefImplicitLodOpGenericAdaptorBase::ImageSampleProjDrefImplicitLodOpGenericAdaptorBase(ImageSampleProjDrefImplicitLodOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair ImageSampleProjDrefImplicitLodOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {false, 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 - 3) / 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}; } ::std::optional<::mlir::spirv::ImageOperands> ImageSampleProjDrefImplicitLodOpGenericAdaptorBase::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } } // namespace detail ImageSampleProjDrefImplicitLodOpAdaptor::ImageSampleProjDrefImplicitLodOpAdaptor(ImageSampleProjDrefImplicitLodOp op) : ImageSampleProjDrefImplicitLodOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageSampleProjDrefImplicitLodOpAdaptor::verify(::mlir::Location loc) { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (tblgen_image_operands && !((::llvm::isa<::mlir::spirv::ImageOperandsAttr>(tblgen_image_operands)))) return emitError(loc, "'spirv.ImageSampleProjDrefImplicitLod' op attribute 'image_operands' failed to satisfy constraint: valid SPIR-V ImageOperands"); return ::mlir::success(); } std::pair ImageSampleProjDrefImplicitLodOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {false, 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() - 3) / 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 ImageSampleProjDrefImplicitLodOp::getOperandArgumentsMutable() { auto range = getODSOperandIndexAndLength(3); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult ImageSampleProjDrefImplicitLodOp::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.image_operands; auto attr = dict.get("image_operands"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `image_operands` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ImageSampleProjDrefImplicitLodOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.image_operands; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("image_operands", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ImageSampleProjDrefImplicitLodOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.image_operands.getAsOpaquePointer())); } std::optional ImageSampleProjDrefImplicitLodOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "image_operands") return prop.image_operands; return std::nullopt; } void ImageSampleProjDrefImplicitLodOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "image_operands") { prop.image_operands = ::llvm::dyn_cast_or_null>(value); return; } } void ImageSampleProjDrefImplicitLodOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.image_operands) attrs.append("image_operands", prop.image_operands); } ::llvm::LogicalResult ImageSampleProjDrefImplicitLodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getImageOperandsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(attr, "image_operands", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ImageSampleProjDrefImplicitLodOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.image_operands))) return ::mlir::failure(); return ::mlir::success(); } void ImageSampleProjDrefImplicitLodOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.image_operands); } ::std::optional<::mlir::spirv::ImageOperands> ImageSampleProjDrefImplicitLodOp::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } void ImageSampleProjDrefImplicitLodOp::setImageOperands(::std::optional<::mlir::spirv::ImageOperands> attrValue) { auto &odsProp = getProperties().image_operands; if (attrValue) odsProp = ::mlir::spirv::ImageOperandsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void ImageSampleProjDrefImplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(dref); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } odsState.addTypes(result); } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(result), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleProjDrefImplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(dref); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ImageSampleProjDrefImplicitLodOp::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); } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleProjDrefImplicitLodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(sampled_image); odsState.addOperands(coordinate); odsState.addOperands(dref); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sampled_image, ::mlir::Value coordinate, ::mlir::Value dref, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(sampled_image), std::forward(coordinate), std::forward(dref), std::forward(image_operands), std::forward(operand_arguments)); } void ImageSampleProjDrefImplicitLodOp::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(); ::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."); } } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageSampleProjDrefImplicitLodOp::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(); ::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(ImageSampleProjDrefImplicitLodOp::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)."); } } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void ImageSampleProjDrefImplicitLodOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void ImageSampleProjDrefImplicitLodOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ImageSampleProjDrefImplicitLodOp::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)."); } } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageSampleProjDrefImplicitLodOp ImageSampleProjDrefImplicitLodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageSampleProjDrefImplicitLodOp::verifyInvariantsImpl() { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(*this, tblgen_image_operands, "image_operands"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps39(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps44(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps40(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*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_SPIRVOps6(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(!((::llvm::is_contained({::mlir::spirv::Dim::Buffer},::llvm::cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getDim()))))) return emitOpError("failed to verify that the Dim operand of the underlying image must not be Buffer"); if (!((::llvm::is_contained({::mlir::spirv::ImageSamplingInfo::SingleSampled},::llvm::cast<::mlir::spirv::ImageType>(llvm::cast<::mlir::spirv::SampledImageType>((*this->getODSOperands(0).begin()).getType()).getImageType()).getSamplingInfo())))) return emitOpError("failed to verify that the MS operand of the underlying image type must be SingleSampled"); if (!((std::equal_to<>()(::llvm::cast<::mlir::spirv::ImageType>(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getImageType()).getElementType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of 'result' matches image type of 'sampled_image'"); return ::mlir::success(); } ::llvm::LogicalResult ImageSampleProjDrefImplicitLodOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult ImageSampleProjDrefImplicitLodOp::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 = ::llvm::cast<::mlir::spirv::ImageType>(::llvm::cast(operands[0].getType()).getImageType()).getElementType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult ImageSampleProjDrefImplicitLodOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand sampled_imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sampled_imageOperands(&sampled_imageRawOperand, 1); ::llvm::SMLoc sampled_imageOperandsLoc; (void)sampled_imageOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand coordinateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coordinateOperands(&coordinateRawOperand, 1); ::llvm::SMLoc coordinateOperandsLoc; (void)coordinateOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand drefRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> drefOperands(&drefRawOperand, 1); ::llvm::SMLoc drefOperandsLoc; (void)drefOperandsLoc; ::mlir::spirv::ImageOperandsAttr image_operandsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operand_argumentsOperands; ::llvm::SMLoc operand_argumentsOperandsLoc; (void)operand_argumentsOperandsLoc; ::mlir::Type sampled_imageRawType{}; ::llvm::ArrayRef<::mlir::Type> sampled_imageTypes(&sampled_imageRawType, 1); ::mlir::Type coordinateRawType{}; ::llvm::ArrayRef<::mlir::Type> coordinateTypes(&coordinateRawType, 1); ::mlir::Type drefRawType{}; ::llvm::ArrayRef<::mlir::Type> drefTypes(&drefRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> operand_argumentsTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); sampled_imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(sampled_imageRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); coordinateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(coordinateRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); drefOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(drefRawOperand)) return ::mlir::failure(); { auto odsResult = parseImageOperands(parser, image_operandsAttr); if (odsResult) return ::mlir::failure(); if (image_operandsAttr) result.getOrAddProperties().image_operands = image_operandsAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { operand_argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(operand_argumentsOperands)) 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(); sampled_imageRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); coordinateRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::FloatType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); drefRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseTypeList(operand_argumentsTypes)) return ::mlir::failure(); } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(sampled_imageOperands, sampled_imageTypes, sampled_imageOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(coordinateOperands, coordinateTypes, coordinateOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(drefOperands, drefTypes, drefOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand_argumentsOperands, operand_argumentsTypes, operand_argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageSampleProjDrefImplicitLodOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getSampledImage(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getCoordinate(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getDref(); _odsPrinter << ' '; printImageOperands(_odsPrinter, *this, getImageOperandsAttr()); if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments(); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("image_operands"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getSampledImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getCoordinate().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getDref().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageSampleProjDrefImplicitLodOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ImageSampleProjDrefImplicitLodOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ImageWriteOp definitions //===----------------------------------------------------------------------===// namespace detail { ImageWriteOpGenericAdaptorBase::ImageWriteOpGenericAdaptorBase(ImageWriteOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair ImageWriteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {false, 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 - 3) / 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}; } ::std::optional<::mlir::spirv::ImageOperands> ImageWriteOpGenericAdaptorBase::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } } // namespace detail ImageWriteOpAdaptor::ImageWriteOpAdaptor(ImageWriteOp op) : ImageWriteOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ImageWriteOpAdaptor::verify(::mlir::Location loc) { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (tblgen_image_operands && !((::llvm::isa<::mlir::spirv::ImageOperandsAttr>(tblgen_image_operands)))) return emitError(loc, "'spirv.ImageWrite' op attribute 'image_operands' failed to satisfy constraint: valid SPIR-V ImageOperands"); return ::mlir::success(); } std::pair ImageWriteOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {false, 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() - 3) / 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 ImageWriteOp::getOperandArgumentsMutable() { auto range = getODSOperandIndexAndLength(3); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult ImageWriteOp::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.image_operands; auto attr = dict.get("image_operands"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `image_operands` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ImageWriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.image_operands; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("image_operands", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ImageWriteOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.image_operands.getAsOpaquePointer())); } std::optional ImageWriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "image_operands") return prop.image_operands; return std::nullopt; } void ImageWriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "image_operands") { prop.image_operands = ::llvm::dyn_cast_or_null>(value); return; } } void ImageWriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.image_operands) attrs.append("image_operands", prop.image_operands); } ::llvm::LogicalResult ImageWriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getImageOperandsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(attr, "image_operands", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ImageWriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.image_operands))) return ::mlir::failure(); return ::mlir::success(); } void ImageWriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.image_operands); } ::std::optional<::mlir::spirv::ImageOperands> ImageWriteOp::getImageOperands() { auto attr = getImageOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::ImageOperands>(attr.getValue()) : (::std::nullopt); } void ImageWriteOp::setImageOperands(::std::optional<::mlir::spirv::ImageOperands> attrValue) { auto &odsProp = getProperties().image_operands; if (attrValue) odsProp = ::mlir::spirv::ImageOperandsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void ImageWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value image, ::mlir::Value coordinate, ::mlir::Value texel, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(image); odsState.addOperands(coordinate); odsState.addOperands(texel); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } } ImageWriteOp ImageWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value image, ::mlir::Value coordinate, ::mlir::Value texel, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(image), std::forward(coordinate), std::forward(texel), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageWriteOp ImageWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value image, ::mlir::Value coordinate, ::mlir::Value texel, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(image), std::forward(coordinate), std::forward(texel), std::forward(image_operands), std::forward(operand_arguments)); } void ImageWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, ::mlir::Value texel, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { odsState.addOperands(image); odsState.addOperands(coordinate); odsState.addOperands(texel); odsState.addOperands(operand_arguments); if (image_operands) { odsState.getOrAddProperties().image_operands = image_operands; } assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ImageWriteOp ImageWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, ::mlir::Value texel, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(image), std::forward(coordinate), std::forward(texel), std::forward(image_operands), std::forward(operand_arguments)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageWriteOp ImageWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value coordinate, ::mlir::Value texel, /*optional*/::mlir::spirv::ImageOperandsAttr image_operands, ::mlir::ValueRange operand_arguments) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(image), std::forward(coordinate), std::forward(texel), std::forward(image_operands), std::forward(operand_arguments)); } void ImageWriteOp::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() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } ImageWriteOp ImageWriteOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageWriteOp ImageWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ImageWriteOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ImageWriteOp ImageWriteOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ImageWriteOp ImageWriteOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ImageWriteOp::verifyInvariantsImpl() { auto tblgen_image_operands = getProperties().image_operands; (void)tblgen_image_operands; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps23(*this, tblgen_image_operands, "image_operands"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps42(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps44(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps44(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps9(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } if (!((::llvm::is_contained({::mlir::spirv::ImageSamplerUseInfo::SamplerUnknown, ::mlir::spirv::ImageSamplerUseInfo::NoSampler},::llvm::cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getSamplerUseInfo())))) return emitOpError("failed to verify that the sampled operand of the underlying image must be SamplerUnknown or NoSampler"); if (!(!((::llvm::is_contained({::mlir::spirv::Dim::SubpassData},::llvm::cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getDim()))))) return emitOpError("failed to verify that the Dim operand of the underlying image must not be SubpassData"); if (!((::llvm::isa(cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getElementType()) ||(getElementTypeOrSelf((*this->getODSOperands(2).begin()))==cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getElementType())))) return emitOpError("failed to verify that the texel component type must match the image sampled type"); return ::mlir::success(); } ::llvm::LogicalResult ImageWriteOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ImageWriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> imageOperands(&imageRawOperand, 1); ::llvm::SMLoc imageOperandsLoc; (void)imageOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand coordinateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coordinateOperands(&coordinateRawOperand, 1); ::llvm::SMLoc coordinateOperandsLoc; (void)coordinateOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand texelRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> texelOperands(&texelRawOperand, 1); ::llvm::SMLoc texelOperandsLoc; (void)texelOperandsLoc; ::mlir::spirv::ImageOperandsAttr image_operandsAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operand_argumentsOperands; ::llvm::SMLoc operand_argumentsOperandsLoc; (void)operand_argumentsOperandsLoc; ::mlir::Type imageRawType{}; ::llvm::ArrayRef<::mlir::Type> imageTypes(&imageRawType, 1); ::mlir::Type coordinateRawType{}; ::llvm::ArrayRef<::mlir::Type> coordinateTypes(&coordinateRawType, 1); ::mlir::Type texelRawType{}; ::llvm::ArrayRef<::mlir::Type> texelTypes(&texelRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> operand_argumentsTypes; imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(imageRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); coordinateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(coordinateRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); texelOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(texelRawOperand)) return ::mlir::failure(); { auto odsResult = parseImageOperands(parser, image_operandsAttr); if (odsResult) return ::mlir::failure(); if (image_operandsAttr) result.getOrAddProperties().image_operands = image_operandsAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { operand_argumentsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(operand_argumentsOperands)) 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(); imageRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); coordinateRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); texelRawType = type; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseTypeList(operand_argumentsTypes)) return ::mlir::failure(); } if (parser.resolveOperands(imageOperands, imageTypes, imageOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(coordinateOperands, coordinateTypes, coordinateOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(texelOperands, texelTypes, texelOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand_argumentsOperands, operand_argumentsTypes, operand_argumentsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ImageWriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getImage(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getCoordinate(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getTexel(); _odsPrinter << ' '; printImageOperands(_odsPrinter, *this, getImageOperandsAttr()); if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments(); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("image_operands"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getCoordinate().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getTexel().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getOperandArguments().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperandArguments().getTypes(); } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ImageWriteOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ImageWriteOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::InBoundsPtrAccessChainOp definitions //===----------------------------------------------------------------------===// namespace detail { InBoundsPtrAccessChainOpGenericAdaptorBase::InBoundsPtrAccessChainOpGenericAdaptorBase(InBoundsPtrAccessChainOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair InBoundsPtrAccessChainOpGenericAdaptorBase::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}; } } // namespace detail InBoundsPtrAccessChainOpAdaptor::InBoundsPtrAccessChainOpAdaptor(InBoundsPtrAccessChainOp op) : InBoundsPtrAccessChainOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult InBoundsPtrAccessChainOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair InBoundsPtrAccessChainOp::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 InBoundsPtrAccessChainOp::getIndicesMutable() { auto range = getODSOperandIndexAndLength(2); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult InBoundsPtrAccessChainOp::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 InBoundsPtrAccessChainOp::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 InBoundsPtrAccessChainOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional InBoundsPtrAccessChainOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void InBoundsPtrAccessChainOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void InBoundsPtrAccessChainOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult InBoundsPtrAccessChainOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value basePtr, Value element, ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(basePtr), std::forward(element), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, Value basePtr, Value element, ValueRange indices) { return create(builder, builder.getLoc(), std::forward(basePtr), std::forward(element), std::forward(indices)); } void InBoundsPtrAccessChainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { odsState.addOperands(base_ptr); odsState.addOperands(element); odsState.addOperands(indices); odsState.addTypes(result); } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(base_ptr), std::forward(element), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { return create(builder, builder.getLoc(), std::forward(result), std::forward(base_ptr), std::forward(element), std::forward(indices)); } void InBoundsPtrAccessChainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { odsState.addOperands(base_ptr); odsState.addOperands(element); odsState.addOperands(indices); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(base_ptr), std::forward(element), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(base_ptr), std::forward(element), std::forward(indices)); } void InBoundsPtrAccessChainOp::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); } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void InBoundsPtrAccessChainOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } InBoundsPtrAccessChainOp InBoundsPtrAccessChainOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult InBoundsPtrAccessChainOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps2(*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_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult InBoundsPtrAccessChainOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult InBoundsPtrAccessChainOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand base_ptrRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> base_ptrOperands(&base_ptrRawOperand, 1); ::llvm::SMLoc base_ptrOperandsLoc; (void)base_ptrOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand elementRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> elementOperands(&elementRawOperand, 1); ::llvm::SMLoc elementOperandsLoc; (void)elementOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; ::llvm::SMLoc indicesOperandsLoc; (void)indicesOperandsLoc; ::mlir::Type base_ptrRawType{}; ::llvm::ArrayRef<::mlir::Type> base_ptrTypes(&base_ptrRawType, 1); ::mlir::Type elementRawType{}; ::llvm::ArrayRef<::mlir::Type> elementTypes(&elementRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); base_ptrOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(base_ptrRawOperand)) return ::mlir::failure(); if (parser.parseLSquare()) return ::mlir::failure(); elementOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(elementRawOperand)) return ::mlir::failure(); indicesOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(indicesOperands)) return ::mlir::failure(); if (!indicesOperands.empty()) { } 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::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); base_ptrRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); elementRawType = 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(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(base_ptrOperands, base_ptrTypes, base_ptrOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(elementOperands, elementTypes, elementOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void InBoundsPtrAccessChainOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getBasePtr(); _odsPrinter << "["; _odsPrinter << getElement(); if (!getIndices().empty()) { _odsPrinter << ' '; _odsPrinter << getIndices(); } _odsPrinter << "]"; ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getBasePtr().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getElement().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getIndices().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getIndices().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void InBoundsPtrAccessChainOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::InBoundsPtrAccessChainOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::IsFiniteOp definitions //===----------------------------------------------------------------------===// namespace detail { IsFiniteOpGenericAdaptorBase::IsFiniteOpGenericAdaptorBase(IsFiniteOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail IsFiniteOpAdaptor::IsFiniteOpAdaptor(IsFiniteOp op) : IsFiniteOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult IsFiniteOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult IsFiniteOp::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 IsFiniteOp::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 IsFiniteOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional IsFiniteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void IsFiniteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void IsFiniteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult IsFiniteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void IsFiniteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } IsFiniteOp IsFiniteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsFiniteOp IsFiniteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void IsFiniteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IsFiniteOp::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); } IsFiniteOp IsFiniteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsFiniteOp IsFiniteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void IsFiniteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } IsFiniteOp IsFiniteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsFiniteOp IsFiniteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void IsFiniteOp::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); } IsFiniteOp IsFiniteOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsFiniteOp IsFiniteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void IsFiniteOp::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(IsFiniteOp::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)."); } } IsFiniteOp IsFiniteOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsFiniteOp IsFiniteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void IsFiniteOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } IsFiniteOp IsFiniteOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsFiniteOp IsFiniteOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void IsFiniteOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IsFiniteOp::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)."); } } IsFiniteOp IsFiniteOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsFiniteOp IsFiniteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult IsFiniteOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult IsFiniteOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult IsFiniteOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult IsFiniteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } for (::mlir::Type type : operandTypes) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operandTypes[0])); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void IsFiniteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void IsFiniteOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::IsFiniteOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::IsInfOp definitions //===----------------------------------------------------------------------===// namespace detail { IsInfOpGenericAdaptorBase::IsInfOpGenericAdaptorBase(IsInfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail IsInfOpAdaptor::IsInfOpAdaptor(IsInfOp op) : IsInfOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult IsInfOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult IsInfOp::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 IsInfOp::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 IsInfOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional IsInfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void IsInfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void IsInfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult IsInfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void IsInfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } IsInfOp IsInfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsInfOp IsInfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void IsInfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IsInfOp::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); } IsInfOp IsInfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsInfOp IsInfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void IsInfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } IsInfOp IsInfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsInfOp IsInfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void IsInfOp::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); } IsInfOp IsInfOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsInfOp IsInfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void IsInfOp::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(IsInfOp::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)."); } } IsInfOp IsInfOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsInfOp IsInfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void IsInfOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } IsInfOp IsInfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsInfOp IsInfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void IsInfOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IsInfOp::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)."); } } IsInfOp IsInfOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsInfOp IsInfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult IsInfOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult IsInfOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult IsInfOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult IsInfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } for (::mlir::Type type : operandTypes) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operandTypes[0])); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void IsInfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void IsInfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::IsInfOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::IsNanOp definitions //===----------------------------------------------------------------------===// namespace detail { IsNanOpGenericAdaptorBase::IsNanOpGenericAdaptorBase(IsNanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail IsNanOpAdaptor::IsNanOpAdaptor(IsNanOp op) : IsNanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult IsNanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult IsNanOp::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 IsNanOp::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 IsNanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional IsNanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void IsNanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void IsNanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult IsNanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void IsNanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } IsNanOp IsNanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNanOp IsNanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void IsNanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IsNanOp::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); } IsNanOp IsNanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNanOp IsNanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void IsNanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } IsNanOp IsNanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNanOp IsNanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void IsNanOp::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); } IsNanOp IsNanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNanOp IsNanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void IsNanOp::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(IsNanOp::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)."); } } IsNanOp IsNanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNanOp IsNanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void IsNanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } IsNanOp IsNanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNanOp IsNanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void IsNanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IsNanOp::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)."); } } IsNanOp IsNanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNanOp IsNanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult IsNanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult IsNanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult IsNanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult IsNanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } for (::mlir::Type type : operandTypes) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operandTypes[0])); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void IsNanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void IsNanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::IsNanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::IsNormalOp definitions //===----------------------------------------------------------------------===// namespace detail { IsNormalOpGenericAdaptorBase::IsNormalOpGenericAdaptorBase(IsNormalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail IsNormalOpAdaptor::IsNormalOpAdaptor(IsNormalOp op) : IsNormalOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult IsNormalOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult IsNormalOp::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 IsNormalOp::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 IsNormalOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional IsNormalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void IsNormalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void IsNormalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult IsNormalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void IsNormalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } IsNormalOp IsNormalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNormalOp IsNormalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void IsNormalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IsNormalOp::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); } IsNormalOp IsNormalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNormalOp IsNormalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void IsNormalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } IsNormalOp IsNormalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNormalOp IsNormalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void IsNormalOp::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); } IsNormalOp IsNormalOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNormalOp IsNormalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void IsNormalOp::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(IsNormalOp::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)."); } } IsNormalOp IsNormalOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNormalOp IsNormalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void IsNormalOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } IsNormalOp IsNormalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNormalOp IsNormalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void IsNormalOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(IsNormalOp::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)."); } } IsNormalOp IsNormalOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } IsNormalOp IsNormalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult IsNormalOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult IsNormalOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult IsNormalOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult IsNormalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } for (::mlir::Type type : operandTypes) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operandTypes[0])); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void IsNormalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void IsNormalOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::IsNormalOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::KHRAssumeTrueOp definitions //===----------------------------------------------------------------------===// namespace detail { KHRAssumeTrueOpGenericAdaptorBase::KHRAssumeTrueOpGenericAdaptorBase(KHRAssumeTrueOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail KHRAssumeTrueOpAdaptor::KHRAssumeTrueOpAdaptor(KHRAssumeTrueOp op) : KHRAssumeTrueOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult KHRAssumeTrueOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult KHRAssumeTrueOp::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 KHRAssumeTrueOp::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 KHRAssumeTrueOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional KHRAssumeTrueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void KHRAssumeTrueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void KHRAssumeTrueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult KHRAssumeTrueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void KHRAssumeTrueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition) { odsState.addOperands(condition); } KHRAssumeTrueOp KHRAssumeTrueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value condition) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(condition)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRAssumeTrueOp KHRAssumeTrueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value condition) { return create(builder, builder.getLoc(), std::forward(condition)); } void KHRAssumeTrueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition) { odsState.addOperands(condition); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRAssumeTrueOp KHRAssumeTrueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(condition)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRAssumeTrueOp KHRAssumeTrueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(condition)); } void KHRAssumeTrueOp::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); } KHRAssumeTrueOp KHRAssumeTrueOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRAssumeTrueOp KHRAssumeTrueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void KHRAssumeTrueOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } KHRAssumeTrueOp KHRAssumeTrueOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRAssumeTrueOp KHRAssumeTrueOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult KHRAssumeTrueOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps4(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult KHRAssumeTrueOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult KHRAssumeTrueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand conditionRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(&conditionRawOperand, 1); ::llvm::SMLoc conditionOperandsLoc; (void)conditionOperandsLoc; conditionOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(conditionRawOperand)) 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(); } ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); if (parser.resolveOperands(conditionOperands, odsBuildableType0, conditionOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void KHRAssumeTrueOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getCondition(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::KHRAssumeTrueOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::KHRCooperativeMatrixLengthOp definitions //===----------------------------------------------------------------------===// namespace detail { KHRCooperativeMatrixLengthOpGenericAdaptorBase::KHRCooperativeMatrixLengthOpGenericAdaptorBase(KHRCooperativeMatrixLengthOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::Type KHRCooperativeMatrixLengthOpGenericAdaptorBase::getCooperativeMatrixType() { auto attr = getCooperativeMatrixTypeAttr(); return ::llvm::cast<::mlir::Type>(attr.getValue()); } } // namespace detail KHRCooperativeMatrixLengthOpAdaptor::KHRCooperativeMatrixLengthOpAdaptor(KHRCooperativeMatrixLengthOp op) : KHRCooperativeMatrixLengthOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult KHRCooperativeMatrixLengthOpAdaptor::verify(::mlir::Location loc) { auto tblgen_cooperative_matrix_type = getProperties().cooperative_matrix_type; (void)tblgen_cooperative_matrix_type; if (!tblgen_cooperative_matrix_type) return emitError(loc, "'spirv.KHR.CooperativeMatrixLength' op requires attribute 'cooperative_matrix_type'"); if (tblgen_cooperative_matrix_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_cooperative_matrix_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_cooperative_matrix_type).getValue()))) && ((::llvm::isa<::mlir::spirv::CooperativeMatrixType>(::llvm::cast<::mlir::TypeAttr>(tblgen_cooperative_matrix_type).getValue()))))) return emitError(loc, "'spirv.KHR.CooperativeMatrixLength' op attribute 'cooperative_matrix_type' failed to satisfy constraint: type attribute of any SPIR-V cooperative matrix type"); return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixLengthOp::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.cooperative_matrix_type; auto attr = dict.get("cooperative_matrix_type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `cooperative_matrix_type` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute KHRCooperativeMatrixLengthOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.cooperative_matrix_type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("cooperative_matrix_type", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code KHRCooperativeMatrixLengthOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.cooperative_matrix_type.getAsOpaquePointer())); } std::optional KHRCooperativeMatrixLengthOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "cooperative_matrix_type") return prop.cooperative_matrix_type; return std::nullopt; } void KHRCooperativeMatrixLengthOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "cooperative_matrix_type") { prop.cooperative_matrix_type = ::llvm::dyn_cast_or_null>(value); return; } } void KHRCooperativeMatrixLengthOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.cooperative_matrix_type) attrs.append("cooperative_matrix_type", prop.cooperative_matrix_type); } ::llvm::LogicalResult KHRCooperativeMatrixLengthOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getCooperativeMatrixTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps24(attr, "cooperative_matrix_type", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixLengthOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.cooperative_matrix_type))) return ::mlir::failure(); return ::mlir::success(); } void KHRCooperativeMatrixLengthOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.cooperative_matrix_type); } ::mlir::Type KHRCooperativeMatrixLengthOp::getCooperativeMatrixType() { auto attr = getCooperativeMatrixTypeAttr(); return ::llvm::cast<::mlir::Type>(attr.getValue()); } void KHRCooperativeMatrixLengthOp::setCooperativeMatrixType(::mlir::Type attrValue) { getProperties().cooperative_matrix_type = ::mlir::TypeAttr::get(attrValue); } void KHRCooperativeMatrixLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::TypeAttr cooperative_matrix_type) { odsState.getOrAddProperties().cooperative_matrix_type = cooperative_matrix_type; odsState.addTypes(result); } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::TypeAttr cooperative_matrix_type) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(cooperative_matrix_type)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::TypeAttr cooperative_matrix_type) { return create(builder, builder.getLoc(), std::forward(result), std::forward(cooperative_matrix_type)); } void KHRCooperativeMatrixLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr cooperative_matrix_type) { odsState.getOrAddProperties().cooperative_matrix_type = cooperative_matrix_type; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(KHRCooperativeMatrixLengthOp::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); } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeAttr cooperative_matrix_type) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(cooperative_matrix_type)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeAttr cooperative_matrix_type) { return create(builder, builder.getLoc(), std::forward(cooperative_matrix_type)); } void KHRCooperativeMatrixLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr cooperative_matrix_type) { odsState.getOrAddProperties().cooperative_matrix_type = cooperative_matrix_type; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr cooperative_matrix_type) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(cooperative_matrix_type)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr cooperative_matrix_type) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(cooperative_matrix_type)); } void KHRCooperativeMatrixLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Type cooperative_matrix_type) { odsState.getOrAddProperties().cooperative_matrix_type = ::mlir::TypeAttr::get(cooperative_matrix_type); odsState.addTypes(result); } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Type cooperative_matrix_type) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(cooperative_matrix_type)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Type cooperative_matrix_type) { return create(builder, builder.getLoc(), std::forward(result), std::forward(cooperative_matrix_type)); } void KHRCooperativeMatrixLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type cooperative_matrix_type) { odsState.getOrAddProperties().cooperative_matrix_type = ::mlir::TypeAttr::get(cooperative_matrix_type); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(KHRCooperativeMatrixLengthOp::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); } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type cooperative_matrix_type) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(cooperative_matrix_type)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type cooperative_matrix_type) { return create(builder, builder.getLoc(), std::forward(cooperative_matrix_type)); } void KHRCooperativeMatrixLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type cooperative_matrix_type) { odsState.getOrAddProperties().cooperative_matrix_type = ::mlir::TypeAttr::get(cooperative_matrix_type); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Type cooperative_matrix_type) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(cooperative_matrix_type)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Type cooperative_matrix_type) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(cooperative_matrix_type)); } void KHRCooperativeMatrixLengthOp::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() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void KHRCooperativeMatrixLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { assert(operands.size() == 0u && "mismatched number of parameters"); odsState.addOperands(operands); odsState.addAttributes(attributes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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(KHRCooperativeMatrixLengthOp::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)."); } } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void KHRCooperativeMatrixLengthOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void KHRCooperativeMatrixLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(KHRCooperativeMatrixLengthOp::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)."); } } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLengthOp KHRCooperativeMatrixLengthOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult KHRCooperativeMatrixLengthOp::verifyInvariantsImpl() { auto tblgen_cooperative_matrix_type = getProperties().cooperative_matrix_type; (void)tblgen_cooperative_matrix_type; if (!tblgen_cooperative_matrix_type) return emitOpError("requires attribute 'cooperative_matrix_type'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps24(*this, tblgen_cooperative_matrix_type, "cooperative_matrix_type"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps27(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixLengthOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult KHRCooperativeMatrixLengthOp::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 KHRCooperativeMatrixLengthOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::TypeAttr cooperative_matrix_typeAttr; { 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(cooperative_matrix_typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { return ::mlir::failure(); } if (cooperative_matrix_typeAttr) result.getOrAddProperties().cooperative_matrix_type = cooperative_matrix_typeAttr; ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); result.addTypes(odsBuildableType0); return ::mlir::success(); } void KHRCooperativeMatrixLengthOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("cooperative_matrix_type"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getCooperativeMatrixTypeAttr()); } void KHRCooperativeMatrixLengthOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::KHRCooperativeMatrixLengthOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::KHRCooperativeMatrixLengthOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::KHRCooperativeMatrixLoadOp definitions //===----------------------------------------------------------------------===// namespace detail { KHRCooperativeMatrixLoadOpGenericAdaptorBase::KHRCooperativeMatrixLoadOpGenericAdaptorBase(KHRCooperativeMatrixLoadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::CooperativeMatrixLayoutKHR KHRCooperativeMatrixLoadOpGenericAdaptorBase::getMatrixLayout() { auto attr = getMatrixLayoutAttr(); return attr.getValue(); } ::std::optional<::mlir::spirv::MemoryAccess> KHRCooperativeMatrixLoadOpGenericAdaptorBase::getMemoryOperand() { auto attr = getMemoryOperandAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional KHRCooperativeMatrixLoadOpGenericAdaptorBase::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } } // namespace detail KHRCooperativeMatrixLoadOpAdaptor::KHRCooperativeMatrixLoadOpAdaptor(KHRCooperativeMatrixLoadOp op) : KHRCooperativeMatrixLoadOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult KHRCooperativeMatrixLoadOpAdaptor::verify(::mlir::Location loc) { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_matrix_layout = getProperties().matrix_layout; (void)tblgen_matrix_layout; if (!tblgen_matrix_layout) return emitError(loc, "'spirv.KHR.CooperativeMatrixLoad' op requires attribute 'matrix_layout'"); auto tblgen_memory_operand = getProperties().memory_operand; (void)tblgen_memory_operand; if (tblgen_matrix_layout && !((::llvm::isa<::mlir::spirv::CooperativeMatrixLayoutKHRAttr>(tblgen_matrix_layout)))) return emitError(loc, "'spirv.KHR.CooperativeMatrixLoad' op attribute 'matrix_layout' failed to satisfy constraint: valid SPIR-V Cooperative Matrix Layout (KHR)"); if (tblgen_memory_operand && !((::llvm::isa<::mlir::spirv::MemoryAccessAttr>(tblgen_memory_operand)))) return emitError(loc, "'spirv.KHR.CooperativeMatrixLoad' op attribute 'memory_operand' failed to satisfy constraint: valid SPIR-V MemoryAccess"); if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32)))) && (((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isStrictlyPositive())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isPowerOf2()))))) return emitError(loc, "'spirv.KHR.CooperativeMatrixLoad' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0"); return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixLoadOp::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.alignment; auto attr = dict.get("alignment"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `alignment` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.matrix_layout; auto attr = dict.get("matrix_layout"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `matrix_layout` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_operand; auto attr = dict.get("memory_operand"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_operand` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute KHRCooperativeMatrixLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.alignment; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("alignment", propStorage)); } { const auto &propStorage = prop.matrix_layout; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("matrix_layout", propStorage)); } { const auto &propStorage = prop.memory_operand; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_operand", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code KHRCooperativeMatrixLoadOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.alignment.getAsOpaquePointer()), llvm::hash_value(prop.matrix_layout.getAsOpaquePointer()), llvm::hash_value(prop.memory_operand.getAsOpaquePointer())); } std::optional KHRCooperativeMatrixLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "alignment") return prop.alignment; if (name == "matrix_layout") return prop.matrix_layout; if (name == "memory_operand") return prop.memory_operand; return std::nullopt; } void KHRCooperativeMatrixLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "alignment") { prop.alignment = ::llvm::dyn_cast_or_null>(value); return; } if (name == "matrix_layout") { prop.matrix_layout = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_operand") { prop.memory_operand = ::llvm::dyn_cast_or_null>(value); return; } } void KHRCooperativeMatrixLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.alignment) attrs.append("alignment", prop.alignment); if (prop.matrix_layout) attrs.append("matrix_layout", prop.matrix_layout); if (prop.memory_operand) attrs.append("memory_operand", prop.memory_operand); } ::llvm::LogicalResult KHRCooperativeMatrixLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(attr, "alignment", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMatrixLayoutAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps25(attr, "matrix_layout", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryOperandAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(attr, "memory_operand", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.matrix_layout))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.memory_operand))) return ::mlir::failure(); return ::mlir::success(); } void KHRCooperativeMatrixLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.alignment); writer.writeAttribute(prop.matrix_layout); writer.writeOptionalAttribute(prop.memory_operand); } ::mlir::spirv::CooperativeMatrixLayoutKHR KHRCooperativeMatrixLoadOp::getMatrixLayout() { auto attr = getMatrixLayoutAttr(); return attr.getValue(); } ::std::optional<::mlir::spirv::MemoryAccess> KHRCooperativeMatrixLoadOp::getMemoryOperand() { auto attr = getMemoryOperandAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional KHRCooperativeMatrixLoadOp::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } void KHRCooperativeMatrixLoadOp::setMatrixLayout(::mlir::spirv::CooperativeMatrixLayoutKHR attrValue) { getProperties().matrix_layout = ::mlir::spirv::CooperativeMatrixLayoutKHRAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void KHRCooperativeMatrixLoadOp::setMemoryOperand(::std::optional<::mlir::spirv::MemoryAccess> attrValue) { auto &odsProp = getProperties().memory_operand; if (attrValue) odsProp = ::mlir::spirv::MemoryAccessAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void KHRCooperativeMatrixLoadOp::setAlignment(::std::optional attrValue) { auto &odsProp = getProperties().alignment; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } void KHRCooperativeMatrixLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type result, Value pointer, spirv::ConstantOp stride, spirv::CooperativeMatrixLayoutKHR layout) { build(odsBuilder, odsState, result, pointer, layout, stride, spirv::MemoryAccessAttr{}, IntegerAttr{}); } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Type result, Value pointer, spirv::ConstantOp stride, spirv::CooperativeMatrixLayoutKHR layout) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(stride), std::forward(layout)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, Type result, Value pointer, spirv::ConstantOp stride, spirv::CooperativeMatrixLayoutKHR layout) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(stride), std::forward(layout)); } void KHRCooperativeMatrixLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(pointer); odsState.addOperands(stride); odsState.getOrAddProperties().matrix_layout = matrix_layout; if (memory_operand) { odsState.getOrAddProperties().memory_operand = memory_operand; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } odsState.addTypes(result); } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); } void KHRCooperativeMatrixLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(pointer); odsState.addOperands(stride); odsState.getOrAddProperties().matrix_layout = matrix_layout; if (memory_operand) { odsState.getOrAddProperties().memory_operand = memory_operand; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); } void KHRCooperativeMatrixLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(pointer); odsState.addOperands(stride); odsState.getOrAddProperties().matrix_layout = ::mlir::spirv::CooperativeMatrixLayoutKHRAttr::get(odsBuilder.getContext(), matrix_layout); if (memory_operand) { odsState.getOrAddProperties().memory_operand = memory_operand; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } odsState.addTypes(result); } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); } void KHRCooperativeMatrixLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(pointer); odsState.addOperands(stride); odsState.getOrAddProperties().matrix_layout = ::mlir::spirv::CooperativeMatrixLayoutKHRAttr::get(odsBuilder.getContext(), matrix_layout); if (memory_operand) { odsState.getOrAddProperties().memory_operand = memory_operand; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); } void KHRCooperativeMatrixLoadOp::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(); ::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."); } } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void KHRCooperativeMatrixLoadOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixLoadOp KHRCooperativeMatrixLoadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult KHRCooperativeMatrixLoadOp::verifyInvariantsImpl() { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_matrix_layout = getProperties().matrix_layout; (void)tblgen_matrix_layout; if (!tblgen_matrix_layout) return emitOpError("requires attribute 'matrix_layout'"); auto tblgen_memory_operand = getProperties().memory_operand; (void)tblgen_memory_operand; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps25(*this, tblgen_matrix_layout, "matrix_layout"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(*this, tblgen_memory_operand, "memory_operand"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(*this, tblgen_alignment, "alignment"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps45(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixLoadOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult KHRCooperativeMatrixLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand pointerRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pointerOperands(&pointerRawOperand, 1); ::llvm::SMLoc pointerOperandsLoc; (void)pointerOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand strideRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> strideOperands(&strideRawOperand, 1); ::llvm::SMLoc strideOperandsLoc; (void)strideOperandsLoc; ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layoutAttr; ::mlir::spirv::MemoryAccessAttr memory_operandAttr; ::mlir::IntegerAttr alignmentAttr; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); pointerOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(pointerRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); strideOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(strideRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(matrix_layoutAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (matrix_layoutAttr) result.getOrAddProperties().matrix_layout = matrix_layoutAttr; if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(memory_operandAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_operandAttr) result.getOrAddProperties().memory_operand = memory_operandAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(alignmentAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (alignmentAttr) result.getOrAddProperties().alignment = alignmentAttr; } { 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(::llvm::concat(pointerOperands, strideOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void KHRCooperativeMatrixLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPointer(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getStride(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMatrixLayoutAttr()); if (getMemoryOperandAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryOperandAttr()); } if (getAlignmentAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAlignmentAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("matrix_layout"); elidedAttrs.push_back("memory_operand"); elidedAttrs.push_back("alignment"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::KHRCooperativeMatrixLoadOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::KHRCooperativeMatrixLoadOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::KHRCooperativeMatrixMulAddOp definitions //===----------------------------------------------------------------------===// namespace detail { KHRCooperativeMatrixMulAddOpGenericAdaptorBase::KHRCooperativeMatrixMulAddOpGenericAdaptorBase(KHRCooperativeMatrixMulAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::CooperativeMatrixOperandsKHR> KHRCooperativeMatrixMulAddOpGenericAdaptorBase::getMatrixOperands() { auto attr = getMatrixOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::CooperativeMatrixOperandsKHR>(attr.getValue()) : (::std::nullopt); } } // namespace detail KHRCooperativeMatrixMulAddOpAdaptor::KHRCooperativeMatrixMulAddOpAdaptor(KHRCooperativeMatrixMulAddOp op) : KHRCooperativeMatrixMulAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult KHRCooperativeMatrixMulAddOpAdaptor::verify(::mlir::Location loc) { auto tblgen_matrix_operands = getProperties().matrix_operands; (void)tblgen_matrix_operands; if (tblgen_matrix_operands && !((::llvm::isa<::mlir::spirv::CooperativeMatrixOperandsKHRAttr>(tblgen_matrix_operands)))) return emitError(loc, "'spirv.KHR.CooperativeMatrixMulAdd' op attribute 'matrix_operands' failed to satisfy constraint: valid SPIR-V Cooperative Matrix Operands (KHR)"); return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixMulAddOp::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.matrix_operands; auto attr = dict.get("matrix_operands"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `matrix_operands` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute KHRCooperativeMatrixMulAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.matrix_operands; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("matrix_operands", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code KHRCooperativeMatrixMulAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.matrix_operands.getAsOpaquePointer())); } std::optional KHRCooperativeMatrixMulAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "matrix_operands") return prop.matrix_operands; return std::nullopt; } void KHRCooperativeMatrixMulAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "matrix_operands") { prop.matrix_operands = ::llvm::dyn_cast_or_null>(value); return; } } void KHRCooperativeMatrixMulAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.matrix_operands) attrs.append("matrix_operands", prop.matrix_operands); } ::llvm::LogicalResult KHRCooperativeMatrixMulAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMatrixOperandsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps26(attr, "matrix_operands", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixMulAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.matrix_operands))) return ::mlir::failure(); return ::mlir::success(); } void KHRCooperativeMatrixMulAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.matrix_operands); } ::std::optional<::mlir::spirv::CooperativeMatrixOperandsKHR> KHRCooperativeMatrixMulAddOp::getMatrixOperands() { auto attr = getMatrixOperandsAttr(); return attr ? ::std::optional<::mlir::spirv::CooperativeMatrixOperandsKHR>(attr.getValue()) : (::std::nullopt); } void KHRCooperativeMatrixMulAddOp::setMatrixOperands(::std::optional<::mlir::spirv::CooperativeMatrixOperandsKHR> attrValue) { auto &odsProp = getProperties().matrix_operands; if (attrValue) odsProp = ::mlir::spirv::CooperativeMatrixOperandsKHRAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void KHRCooperativeMatrixMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value a, Value b, Value c) { build(odsBuilder, odsState, a, b, c, spirv::CooperativeMatrixOperandsKHRAttr{}); } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value a, Value b, Value c) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(a), std::forward(b), std::forward(c)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::ImplicitLocOpBuilder &builder, Value a, Value b, Value c) { return create(builder, builder.getLoc(), std::forward(a), std::forward(b), std::forward(c)); } void KHRCooperativeMatrixMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { odsState.addOperands(a); odsState.addOperands(b); odsState.addOperands(c); if (matrix_operands) { odsState.getOrAddProperties().matrix_operands = matrix_operands; } odsState.addTypes(result); } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(a), std::forward(b), std::forward(c), std::forward(matrix_operands)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { return create(builder, builder.getLoc(), std::forward(result), std::forward(a), std::forward(b), std::forward(c), std::forward(matrix_operands)); } void KHRCooperativeMatrixMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { odsState.addOperands(a); odsState.addOperands(b); odsState.addOperands(c); if (matrix_operands) { odsState.getOrAddProperties().matrix_operands = matrix_operands; } ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(KHRCooperativeMatrixMulAddOp::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); } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(a), std::forward(b), std::forward(c), std::forward(matrix_operands)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { return create(builder, builder.getLoc(), std::forward(a), std::forward(b), std::forward(c), std::forward(matrix_operands)); } void KHRCooperativeMatrixMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { odsState.addOperands(a); odsState.addOperands(b); odsState.addOperands(c); if (matrix_operands) { odsState.getOrAddProperties().matrix_operands = matrix_operands; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(a), std::forward(b), std::forward(c), std::forward(matrix_operands)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, /*optional*/::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operands) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(a), std::forward(b), std::forward(c), std::forward(matrix_operands)); } void KHRCooperativeMatrixMulAddOp::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(); ::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."); } } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void KHRCooperativeMatrixMulAddOp::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(); ::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(KHRCooperativeMatrixMulAddOp::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)."); } } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void KHRCooperativeMatrixMulAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void KHRCooperativeMatrixMulAddOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(KHRCooperativeMatrixMulAddOp::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)."); } } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixMulAddOp KHRCooperativeMatrixMulAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult KHRCooperativeMatrixMulAddOp::verifyInvariantsImpl() { auto tblgen_matrix_operands = getProperties().matrix_operands; (void)tblgen_matrix_operands; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps26(*this, tblgen_matrix_operands, "matrix_operands"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps45(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps45(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps45(*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_SPIRVOps45(*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 {c, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixMulAddOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult KHRCooperativeMatrixMulAddOp::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 KHRCooperativeMatrixMulAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand aRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> aOperands(&aRawOperand, 1); ::llvm::SMLoc aOperandsLoc; (void)aOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand bRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bOperands(&bRawOperand, 1); ::llvm::SMLoc bOperandsLoc; (void)bOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand cRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cOperands(&cRawOperand, 1); ::llvm::SMLoc cOperandsLoc; (void)cOperandsLoc; ::mlir::spirv::CooperativeMatrixOperandsKHRAttr matrix_operandsAttr; ::mlir::Type aRawType{}; ::llvm::ArrayRef<::mlir::Type> aTypes(&aRawType, 1); ::mlir::Type bRawType{}; ::llvm::ArrayRef<::mlir::Type> bTypes(&bRawType, 1); ::mlir::Type cRawType{}; ::llvm::ArrayRef<::mlir::Type> cTypes(&cRawType, 1); aOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(aRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); bOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(bRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); cOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(cRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(matrix_operandsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (matrix_operandsAttr) result.getOrAddProperties().matrix_operands = matrix_operandsAttr; } { 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(); aRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); bRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); cRawType = type; } result.addTypes(cTypes[0]); if (parser.resolveOperands(aOperands, aTypes, aOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(bOperands, bTypes, bOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(cOperands, cTypes, cOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void KHRCooperativeMatrixMulAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getA(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getB(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getC(); if (getMatrixOperandsAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMatrixOperandsAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("matrix_operands"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getA().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getB().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getC().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void KHRCooperativeMatrixMulAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::KHRCooperativeMatrixMulAddOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::KHRCooperativeMatrixMulAddOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::KHRCooperativeMatrixStoreOp definitions //===----------------------------------------------------------------------===// namespace detail { KHRCooperativeMatrixStoreOpGenericAdaptorBase::KHRCooperativeMatrixStoreOpGenericAdaptorBase(KHRCooperativeMatrixStoreOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::CooperativeMatrixLayoutKHR KHRCooperativeMatrixStoreOpGenericAdaptorBase::getMatrixLayout() { auto attr = getMatrixLayoutAttr(); return attr.getValue(); } ::std::optional<::mlir::spirv::MemoryAccess> KHRCooperativeMatrixStoreOpGenericAdaptorBase::getMemoryOperand() { auto attr = getMemoryOperandAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional KHRCooperativeMatrixStoreOpGenericAdaptorBase::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } } // namespace detail KHRCooperativeMatrixStoreOpAdaptor::KHRCooperativeMatrixStoreOpAdaptor(KHRCooperativeMatrixStoreOp op) : KHRCooperativeMatrixStoreOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult KHRCooperativeMatrixStoreOpAdaptor::verify(::mlir::Location loc) { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_matrix_layout = getProperties().matrix_layout; (void)tblgen_matrix_layout; if (!tblgen_matrix_layout) return emitError(loc, "'spirv.KHR.CooperativeMatrixStore' op requires attribute 'matrix_layout'"); auto tblgen_memory_operand = getProperties().memory_operand; (void)tblgen_memory_operand; if (tblgen_matrix_layout && !((::llvm::isa<::mlir::spirv::CooperativeMatrixLayoutKHRAttr>(tblgen_matrix_layout)))) return emitError(loc, "'spirv.KHR.CooperativeMatrixStore' op attribute 'matrix_layout' failed to satisfy constraint: valid SPIR-V Cooperative Matrix Layout (KHR)"); if (tblgen_memory_operand && !((::llvm::isa<::mlir::spirv::MemoryAccessAttr>(tblgen_memory_operand)))) return emitError(loc, "'spirv.KHR.CooperativeMatrixStore' op attribute 'memory_operand' failed to satisfy constraint: valid SPIR-V MemoryAccess"); if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32)))) && (((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isStrictlyPositive())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isPowerOf2()))))) return emitError(loc, "'spirv.KHR.CooperativeMatrixStore' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0"); return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixStoreOp::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.alignment; auto attr = dict.get("alignment"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `alignment` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.matrix_layout; auto attr = dict.get("matrix_layout"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `matrix_layout` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_operand; auto attr = dict.get("memory_operand"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_operand` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute KHRCooperativeMatrixStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.alignment; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("alignment", propStorage)); } { const auto &propStorage = prop.matrix_layout; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("matrix_layout", propStorage)); } { const auto &propStorage = prop.memory_operand; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_operand", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code KHRCooperativeMatrixStoreOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.alignment.getAsOpaquePointer()), llvm::hash_value(prop.matrix_layout.getAsOpaquePointer()), llvm::hash_value(prop.memory_operand.getAsOpaquePointer())); } std::optional KHRCooperativeMatrixStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "alignment") return prop.alignment; if (name == "matrix_layout") return prop.matrix_layout; if (name == "memory_operand") return prop.memory_operand; return std::nullopt; } void KHRCooperativeMatrixStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "alignment") { prop.alignment = ::llvm::dyn_cast_or_null>(value); return; } if (name == "matrix_layout") { prop.matrix_layout = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_operand") { prop.memory_operand = ::llvm::dyn_cast_or_null>(value); return; } } void KHRCooperativeMatrixStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.alignment) attrs.append("alignment", prop.alignment); if (prop.matrix_layout) attrs.append("matrix_layout", prop.matrix_layout); if (prop.memory_operand) attrs.append("memory_operand", prop.memory_operand); } ::llvm::LogicalResult KHRCooperativeMatrixStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(attr, "alignment", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMatrixLayoutAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps25(attr, "matrix_layout", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryOperandAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(attr, "memory_operand", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.matrix_layout))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.memory_operand))) return ::mlir::failure(); return ::mlir::success(); } void KHRCooperativeMatrixStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.alignment); writer.writeAttribute(prop.matrix_layout); writer.writeOptionalAttribute(prop.memory_operand); } ::mlir::spirv::CooperativeMatrixLayoutKHR KHRCooperativeMatrixStoreOp::getMatrixLayout() { auto attr = getMatrixLayoutAttr(); return attr.getValue(); } ::std::optional<::mlir::spirv::MemoryAccess> KHRCooperativeMatrixStoreOp::getMemoryOperand() { auto attr = getMemoryOperandAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional KHRCooperativeMatrixStoreOp::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } void KHRCooperativeMatrixStoreOp::setMatrixLayout(::mlir::spirv::CooperativeMatrixLayoutKHR attrValue) { getProperties().matrix_layout = ::mlir::spirv::CooperativeMatrixLayoutKHRAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void KHRCooperativeMatrixStoreOp::setMemoryOperand(::std::optional<::mlir::spirv::MemoryAccess> attrValue) { auto &odsProp = getProperties().memory_operand; if (attrValue) odsProp = ::mlir::spirv::MemoryAccessAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void KHRCooperativeMatrixStoreOp::setAlignment(::std::optional attrValue) { auto &odsProp = getProperties().alignment; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } void KHRCooperativeMatrixStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value pointer, Value object, spirv::ConstantOp stride, spirv::CooperativeMatrixLayoutKHR layout) { build(odsBuilder, odsState, pointer, object, layout, stride, spirv::MemoryAccessAttr{}, IntegerAttr{}); } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value pointer, Value object, spirv::ConstantOp stride, spirv::CooperativeMatrixLayoutKHR layout) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(object), std::forward(stride), std::forward(layout)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, Value pointer, Value object, spirv::ConstantOp stride, spirv::CooperativeMatrixLayoutKHR layout) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(object), std::forward(stride), std::forward(layout)); } void KHRCooperativeMatrixStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(pointer); odsState.addOperands(object); odsState.addOperands(stride); odsState.getOrAddProperties().matrix_layout = matrix_layout; if (memory_operand) { odsState.getOrAddProperties().memory_operand = memory_operand; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(object), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(object), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); } void KHRCooperativeMatrixStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(pointer); odsState.addOperands(object); odsState.addOperands(stride); odsState.getOrAddProperties().matrix_layout = matrix_layout; if (memory_operand) { odsState.getOrAddProperties().memory_operand = memory_operand; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(object), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(object), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); } void KHRCooperativeMatrixStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(pointer); odsState.addOperands(object); odsState.addOperands(stride); odsState.getOrAddProperties().matrix_layout = ::mlir::spirv::CooperativeMatrixLayoutKHRAttr::get(odsBuilder.getContext(), matrix_layout); if (memory_operand) { odsState.getOrAddProperties().memory_operand = memory_operand; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(object), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(object), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); } void KHRCooperativeMatrixStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(pointer); odsState.addOperands(object); odsState.addOperands(stride); odsState.getOrAddProperties().matrix_layout = ::mlir::spirv::CooperativeMatrixLayoutKHRAttr::get(odsBuilder.getContext(), matrix_layout); if (memory_operand) { odsState.getOrAddProperties().memory_operand = memory_operand; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer), std::forward(object), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer, ::mlir::Value object, ::mlir::spirv::CooperativeMatrixLayoutKHR matrix_layout, ::mlir::Value stride, /*optional*/::mlir::spirv::MemoryAccessAttr memory_operand, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer), std::forward(object), std::forward(matrix_layout), std::forward(stride), std::forward(memory_operand), std::forward(alignment)); } void KHRCooperativeMatrixStoreOp::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() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void KHRCooperativeMatrixStoreOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRCooperativeMatrixStoreOp KHRCooperativeMatrixStoreOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult KHRCooperativeMatrixStoreOp::verifyInvariantsImpl() { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_matrix_layout = getProperties().matrix_layout; (void)tblgen_matrix_layout; if (!tblgen_matrix_layout) return emitOpError("requires attribute 'matrix_layout'"); auto tblgen_memory_operand = getProperties().memory_operand; (void)tblgen_memory_operand; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps25(*this, tblgen_matrix_layout, "matrix_layout"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(*this, tblgen_memory_operand, "memory_operand"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(*this, tblgen_alignment, "alignment"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps45(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult KHRCooperativeMatrixStoreOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult KHRCooperativeMatrixStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand pointerRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pointerOperands(&pointerRawOperand, 1); ::llvm::SMLoc pointerOperandsLoc; (void)pointerOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand objectRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> objectOperands(&objectRawOperand, 1); ::llvm::SMLoc objectOperandsLoc; (void)objectOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand strideRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> strideOperands(&strideRawOperand, 1); ::llvm::SMLoc strideOperandsLoc; (void)strideOperandsLoc; ::mlir::spirv::CooperativeMatrixLayoutKHRAttr matrix_layoutAttr; ::mlir::spirv::MemoryAccessAttr memory_operandAttr; ::mlir::IntegerAttr alignmentAttr; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; pointerOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(pointerRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); objectOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(objectRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); strideOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(strideRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(matrix_layoutAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (matrix_layoutAttr) result.getOrAddProperties().matrix_layout = matrix_layoutAttr; if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(memory_operandAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_operandAttr) result.getOrAddProperties().memory_operand = memory_operandAttr; } if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(alignmentAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (alignmentAttr) result.getOrAddProperties().alignment = alignmentAttr; } { 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.resolveOperands(::llvm::concat(pointerOperands, objectOperands, strideOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void KHRCooperativeMatrixStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPointer(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getObject(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getStride(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMatrixLayoutAttr()); if (getMemoryOperandAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryOperandAttr()); } if (getAlignmentAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAlignmentAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("matrix_layout"); elidedAttrs.push_back("memory_operand"); elidedAttrs.push_back("alignment"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::KHRCooperativeMatrixStoreOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::KHRCooperativeMatrixStoreOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::KHRExpectOp definitions //===----------------------------------------------------------------------===// namespace detail { KHRExpectOpGenericAdaptorBase::KHRExpectOpGenericAdaptorBase(KHRExpectOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail KHRExpectOpAdaptor::KHRExpectOpAdaptor(KHRExpectOp op) : KHRExpectOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult KHRExpectOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult KHRExpectOp::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 KHRExpectOp::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 KHRExpectOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional KHRExpectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void KHRExpectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void KHRExpectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult KHRExpectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void KHRExpectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value, ::mlir::Value expectedValue) { odsState.addOperands(value); odsState.addOperands(expectedValue); odsState.addTypes(result); } KHRExpectOp KHRExpectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value value, ::mlir::Value expectedValue) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(value), std::forward(expectedValue)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRExpectOp KHRExpectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value value, ::mlir::Value expectedValue) { return create(builder, builder.getLoc(), std::forward(result), std::forward(value), std::forward(expectedValue)); } void KHRExpectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value expectedValue) { odsState.addOperands(value); odsState.addOperands(expectedValue); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(KHRExpectOp::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); } KHRExpectOp KHRExpectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value expectedValue) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(value), std::forward(expectedValue)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRExpectOp KHRExpectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value expectedValue) { return create(builder, builder.getLoc(), std::forward(value), std::forward(expectedValue)); } void KHRExpectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value expectedValue) { odsState.addOperands(value); odsState.addOperands(expectedValue); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRExpectOp KHRExpectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value expectedValue) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(value), std::forward(expectedValue)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRExpectOp KHRExpectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value expectedValue) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(value), std::forward(expectedValue)); } void KHRExpectOp::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); } KHRExpectOp KHRExpectOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRExpectOp KHRExpectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void KHRExpectOp::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(KHRExpectOp::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)."); } } KHRExpectOp KHRExpectOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRExpectOp KHRExpectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void KHRExpectOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } KHRExpectOp KHRExpectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRExpectOp KHRExpectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void KHRExpectOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(KHRExpectOp::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)."); } } KHRExpectOp KHRExpectOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRExpectOp KHRExpectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult KHRExpectOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps46(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps46(*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_SPIRVOps46(*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 {value, expectedValue, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult KHRExpectOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult KHRExpectOp::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 KHRExpectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void KHRExpectOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 KHRExpectOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::KHRExpectOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::KHRSubgroupBallotOp definitions //===----------------------------------------------------------------------===// namespace detail { KHRSubgroupBallotOpGenericAdaptorBase::KHRSubgroupBallotOpGenericAdaptorBase(KHRSubgroupBallotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail KHRSubgroupBallotOpAdaptor::KHRSubgroupBallotOpAdaptor(KHRSubgroupBallotOp op) : KHRSubgroupBallotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult KHRSubgroupBallotOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult KHRSubgroupBallotOp::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 KHRSubgroupBallotOp::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 KHRSubgroupBallotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional KHRSubgroupBallotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void KHRSubgroupBallotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void KHRSubgroupBallotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult KHRSubgroupBallotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void KHRSubgroupBallotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value predicate) { odsState.addOperands(predicate); odsState.addTypes(result); } KHRSubgroupBallotOp KHRSubgroupBallotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRSubgroupBallotOp KHRSubgroupBallotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(result), std::forward(predicate)); } void KHRSubgroupBallotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value predicate) { odsState.addOperands(predicate); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } KHRSubgroupBallotOp KHRSubgroupBallotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value predicate) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(predicate)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRSubgroupBallotOp KHRSubgroupBallotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value predicate) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(predicate)); } void KHRSubgroupBallotOp::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); } KHRSubgroupBallotOp KHRSubgroupBallotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRSubgroupBallotOp KHRSubgroupBallotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void KHRSubgroupBallotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } KHRSubgroupBallotOp KHRSubgroupBallotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KHRSubgroupBallotOp KHRSubgroupBallotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult KHRSubgroupBallotOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps4(*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_SPIRVOps47(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult KHRSubgroupBallotOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult KHRSubgroupBallotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand predicateRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> predicateOperands(&predicateRawOperand, 1); ::llvm::SMLoc predicateOperandsLoc; (void)predicateOperandsLoc; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); predicateOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(predicateRawOperand)) 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(); resultRawType = type; } ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); result.addTypes(resultTypes); if (parser.resolveOperands(predicateOperands, odsBuildableType0, predicateOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void KHRSubgroupBallotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPredicate(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::KHRSubgroupBallotOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::KillOp definitions //===----------------------------------------------------------------------===// namespace detail { KillOpGenericAdaptorBase::KillOpGenericAdaptorBase(KillOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail KillOpAdaptor::KillOpAdaptor(KillOp op) : KillOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult KillOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult KillOp::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 KillOp::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 KillOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional KillOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void KillOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void KillOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult KillOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void KillOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { } KillOp KillOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KillOp KillOp::create(::mlir::ImplicitLocOpBuilder &builder) { return create(builder, builder.getLoc()); } void KillOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } KillOp KillOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KillOp KillOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) { return create(builder, builder.getLoc(), std::forward(resultTypes)); } void KillOp::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); } KillOp KillOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KillOp KillOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void KillOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } KillOp KillOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } KillOp KillOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult KillOp::verifyInvariantsImpl() { return ::mlir::success(); } ::llvm::LogicalResult KillOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult KillOp::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 KillOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::KillOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::LoadOp definitions //===----------------------------------------------------------------------===// namespace detail { LoadOpGenericAdaptorBase::LoadOpGenericAdaptorBase(LoadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::MemoryAccess> LoadOpGenericAdaptorBase::getMemoryAccess() { auto attr = getMemoryAccessAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional LoadOpGenericAdaptorBase::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } } // namespace detail LoadOpAdaptor::LoadOpAdaptor(LoadOp op) : LoadOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult LoadOpAdaptor::verify(::mlir::Location loc) { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_memory_access = getProperties().memory_access; (void)tblgen_memory_access; if (tblgen_memory_access && !((::llvm::isa<::mlir::spirv::MemoryAccessAttr>(tblgen_memory_access)))) return emitError(loc, "'spirv.Load' op attribute 'memory_access' failed to satisfy constraint: valid SPIR-V MemoryAccess"); if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32)))) && (((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isStrictlyPositive())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isPowerOf2()))))) return emitError(loc, "'spirv.Load' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0"); return ::mlir::success(); } ::llvm::LogicalResult LoadOp::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.alignment; auto attr = dict.get("alignment"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `alignment` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_access; auto attr = dict.get("memory_access"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_access` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute LoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.alignment; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("alignment", propStorage)); } { const auto &propStorage = prop.memory_access; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_access", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code LoadOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.alignment.getAsOpaquePointer()), llvm::hash_value(prop.memory_access.getAsOpaquePointer())); } std::optional LoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "alignment") return prop.alignment; if (name == "memory_access") return prop.memory_access; return std::nullopt; } void LoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "alignment") { prop.alignment = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_access") { prop.memory_access = ::llvm::dyn_cast_or_null>(value); return; } } void LoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.alignment) attrs.append("alignment", prop.alignment); if (prop.memory_access) attrs.append("memory_access", prop.memory_access); } ::llvm::LogicalResult LoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(attr, "alignment", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryAccessAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(attr, "memory_access", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult LoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.memory_access))) return ::mlir::failure(); return ::mlir::success(); } void LoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.alignment); writer.writeOptionalAttribute(prop.memory_access); } ::std::optional<::mlir::spirv::MemoryAccess> LoadOp::getMemoryAccess() { auto attr = getMemoryAccessAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional LoadOp::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } void LoadOp::setMemoryAccess(::std::optional<::mlir::spirv::MemoryAccess> attrValue) { auto &odsProp = getProperties().memory_access; if (attrValue) odsProp = ::mlir::spirv::MemoryAccessAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void LoadOp::setAlignment(::std::optional attrValue) { auto &odsProp = getProperties().alignment; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value basePtr, MemoryAccessAttr memory_access, IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(basePtr), std::forward(memory_access), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, Value basePtr, MemoryAccessAttr memory_access, IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(basePtr), std::forward(memory_access), std::forward(alignment)); } void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value ptr, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(ptr); if (memory_access) { odsState.getOrAddProperties().memory_access = memory_access; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } odsState.addTypes(value); } LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type value, ::mlir::Value ptr, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(value), std::forward(ptr), std::forward(memory_access), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type value, ::mlir::Value ptr, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(value), std::forward(ptr), std::forward(memory_access), std::forward(alignment)); } void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(ptr); if (memory_access) { odsState.getOrAddProperties().memory_access = memory_access; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(ptr), std::forward(memory_access), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(ptr), std::forward(memory_access), std::forward(alignment)); } void LoadOp::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(); ::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."); } } LoadOp LoadOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void LoadOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } LoadOp LoadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoadOp LoadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult LoadOp::verifyInvariantsImpl() { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_memory_access = getProperties().memory_access; (void)tblgen_memory_access; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(*this, tblgen_memory_access, "memory_access"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(*this, tblgen_alignment, "alignment"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult LoadOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult LoadOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.memory_access; auto memory_accessAttrName = ::mlir::StringAttr::get(ctx, "memory_access"); auto attr = dict.get(memory_accessAttrName); usedKeys.insert(memory_accessAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for memory_access in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_access` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.alignment; auto alignmentAttrName = ::mlir::StringAttr::get(ctx, "alignment"); auto attr = dict.get(alignmentAttrName); usedKeys.insert(alignmentAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for alignment in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `alignment` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::LoadOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::LoadOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::LogicalAndOp definitions //===----------------------------------------------------------------------===// namespace detail { LogicalAndOpGenericAdaptorBase::LogicalAndOpGenericAdaptorBase(LogicalAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail LogicalAndOpAdaptor::LogicalAndOpAdaptor(LogicalAndOp op) : LogicalAndOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult LogicalAndOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult LogicalAndOp::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 LogicalAndOp::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 LogicalAndOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional LogicalAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void LogicalAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void LogicalAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult LogicalAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void LogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } LogicalAndOp LogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void LogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalAndOp::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); } LogicalAndOp LogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void LogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } LogicalAndOp LogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void LogicalAndOp::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); } LogicalAndOp LogicalAndOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void LogicalAndOp::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(LogicalAndOp::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)."); } } LogicalAndOp LogicalAndOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void LogicalAndOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } LogicalAndOp LogicalAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalAndOp LogicalAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void LogicalAndOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalAndOp::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)."); } } LogicalAndOp LogicalAndOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult LogicalAndOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult LogicalAndOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult LogicalAndOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult LogicalAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!(((type.isSignlessInteger(1))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be bool or fixed-length vector of bool values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void LogicalAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void LogicalAndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::LogicalAndOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::LogicalEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { LogicalEqualOpGenericAdaptorBase::LogicalEqualOpGenericAdaptorBase(LogicalEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail LogicalEqualOpAdaptor::LogicalEqualOpAdaptor(LogicalEqualOp op) : LogicalEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult LogicalEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult LogicalEqualOp::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 LogicalEqualOp::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 LogicalEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional LogicalEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void LogicalEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void LogicalEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult LogicalEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void LogicalEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } LogicalEqualOp LogicalEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalEqualOp LogicalEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void LogicalEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalEqualOp::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); } LogicalEqualOp LogicalEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalEqualOp LogicalEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void LogicalEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } LogicalEqualOp LogicalEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalEqualOp LogicalEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void LogicalEqualOp::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); } LogicalEqualOp LogicalEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalEqualOp LogicalEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void LogicalEqualOp::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(LogicalEqualOp::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)."); } } LogicalEqualOp LogicalEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalEqualOp LogicalEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void LogicalEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } LogicalEqualOp LogicalEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalEqualOp LogicalEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void LogicalEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalEqualOp::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)."); } } LogicalEqualOp LogicalEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalEqualOp LogicalEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult LogicalEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult LogicalEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult LogicalEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult LogicalEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!(((type.isSignlessInteger(1))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be bool or fixed-length vector of bool values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void LogicalEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void LogicalEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::LogicalEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::LogicalNotEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { LogicalNotEqualOpGenericAdaptorBase::LogicalNotEqualOpGenericAdaptorBase(LogicalNotEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail LogicalNotEqualOpAdaptor::LogicalNotEqualOpAdaptor(LogicalNotEqualOp op) : LogicalNotEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult LogicalNotEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult LogicalNotEqualOp::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 LogicalNotEqualOp::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 LogicalNotEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional LogicalNotEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void LogicalNotEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void LogicalNotEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult LogicalNotEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void LogicalNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void LogicalNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalNotEqualOp::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); } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void LogicalNotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void LogicalNotEqualOp::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); } LogicalNotEqualOp LogicalNotEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void LogicalNotEqualOp::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(LogicalNotEqualOp::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)."); } } LogicalNotEqualOp LogicalNotEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void LogicalNotEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } LogicalNotEqualOp LogicalNotEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotEqualOp LogicalNotEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void LogicalNotEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalNotEqualOp::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)."); } } LogicalNotEqualOp LogicalNotEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotEqualOp LogicalNotEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult LogicalNotEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult LogicalNotEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult LogicalNotEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult LogicalNotEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!(((type.isSignlessInteger(1))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be bool or fixed-length vector of bool values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void LogicalNotEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void LogicalNotEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::LogicalNotEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::LogicalNotOp definitions //===----------------------------------------------------------------------===// namespace detail { LogicalNotOpGenericAdaptorBase::LogicalNotOpGenericAdaptorBase(LogicalNotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail LogicalNotOpAdaptor::LogicalNotOpAdaptor(LogicalNotOp op) : LogicalNotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult LogicalNotOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult LogicalNotOp::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 LogicalNotOp::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 LogicalNotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional LogicalNotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void LogicalNotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void LogicalNotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult LogicalNotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void LogicalNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } LogicalNotOp LogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void LogicalNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalNotOp::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); } LogicalNotOp LogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void LogicalNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } LogicalNotOp LogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void LogicalNotOp::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); } LogicalNotOp LogicalNotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void LogicalNotOp::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(LogicalNotOp::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)."); } } LogicalNotOp LogicalNotOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void LogicalNotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } LogicalNotOp LogicalNotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotOp LogicalNotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void LogicalNotOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalNotOp::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)."); } } LogicalNotOp LogicalNotOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult LogicalNotOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult LogicalNotOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult LogicalNotOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult LogicalNotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } for (::mlir::Type type : operandTypes) { (void)type; if (!(((type.isSignlessInteger(1))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand' must be bool or fixed-length vector of bool values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operandTypes[0])); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void LogicalNotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void LogicalNotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::LogicalNotOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::LogicalOrOp definitions //===----------------------------------------------------------------------===// namespace detail { LogicalOrOpGenericAdaptorBase::LogicalOrOpGenericAdaptorBase(LogicalOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail LogicalOrOpAdaptor::LogicalOrOpAdaptor(LogicalOrOp op) : LogicalOrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult LogicalOrOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult LogicalOrOp::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 LogicalOrOp::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 LogicalOrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional LogicalOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void LogicalOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void LogicalOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult LogicalOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void LogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } LogicalOrOp LogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void LogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalOrOp::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); } LogicalOrOp LogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void LogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } LogicalOrOp LogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void LogicalOrOp::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); } LogicalOrOp LogicalOrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void LogicalOrOp::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(LogicalOrOp::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)."); } } LogicalOrOp LogicalOrOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void LogicalOrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } LogicalOrOp LogicalOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalOrOp LogicalOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void LogicalOrOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(LogicalOrOp::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)."); } } LogicalOrOp LogicalOrOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult LogicalOrOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult LogicalOrOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult LogicalOrOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult LogicalOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!(((type.isSignlessInteger(1))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be bool or fixed-length vector of bool values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void LogicalOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void LogicalOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::LogicalOrOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::LoopOp definitions //===----------------------------------------------------------------------===// namespace detail { LoopOpGenericAdaptorBase::LoopOpGenericAdaptorBase(LoopOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::LoopControl LoopOpGenericAdaptorBase::getLoopControl() { auto attr = getLoopControlAttr(); return attr.getValue(); } } // namespace detail LoopOpAdaptor::LoopOpAdaptor(LoopOp op) : LoopOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult LoopOpAdaptor::verify(::mlir::Location loc) { auto tblgen_loop_control = getProperties().loop_control; (void)tblgen_loop_control; if (!tblgen_loop_control) return emitError(loc, "'spirv.mlir.loop' op requires attribute 'loop_control'"); if (tblgen_loop_control && !((::llvm::isa<::mlir::spirv::LoopControlAttr>(tblgen_loop_control)))) return emitError(loc, "'spirv.mlir.loop' op attribute 'loop_control' failed to satisfy constraint: valid SPIR-V LoopControl"); return ::mlir::success(); } std::pair LoopOp::getODSResultIndexAndLength(unsigned index) { bool isVariadic[] = {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()->getNumResults() - 0) / 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}; } ::llvm::LogicalResult LoopOp::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.loop_control; auto attr = dict.get("loop_control"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `loop_control` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute LoopOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.loop_control; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("loop_control", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code LoopOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.loop_control.getAsOpaquePointer())); } std::optional LoopOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "loop_control") return prop.loop_control; return std::nullopt; } void LoopOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "loop_control") { prop.loop_control = ::llvm::dyn_cast_or_null>(value); return; } } void LoopOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.loop_control) attrs.append("loop_control", prop.loop_control); } ::llvm::LogicalResult LoopOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getLoopControlAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps27(attr, "loop_control", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult LoopOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.loop_control))) return ::mlir::failure(); return ::mlir::success(); } void LoopOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.loop_control); } ::mlir::spirv::LoopControl LoopOp::getLoopControl() { auto attr = getLoopControlAttr(); return attr.getValue(); } void LoopOp::setLoopControl(::mlir::spirv::LoopControl attrValue) { getProperties().loop_control = ::mlir::spirv::LoopControlAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } LoopOp LoopOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoopOp LoopOp::create(::mlir::ImplicitLocOpBuilder &builder) { return create(builder, builder.getLoc()); } void LoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, spirv::LoopControl loopControl) { build(odsBuilder, odsState, TypeRange(), loopControl); } LoopOp LoopOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, spirv::LoopControl loopControl) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(loopControl)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoopOp LoopOp::create(::mlir::ImplicitLocOpBuilder &builder, spirv::LoopControl loopControl) { return create(builder, builder.getLoc(), std::forward(loopControl)); } void LoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::spirv::LoopControlAttr loop_control) { odsState.getOrAddProperties().loop_control = loop_control; (void)odsState.addRegion(); odsState.addTypes(results); } LoopOp LoopOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::spirv::LoopControlAttr loop_control) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(results), std::forward(loop_control)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoopOp LoopOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::spirv::LoopControlAttr loop_control) { return create(builder, builder.getLoc(), std::forward(results), std::forward(loop_control)); } void LoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::spirv::LoopControl loop_control) { odsState.getOrAddProperties().loop_control = ::mlir::spirv::LoopControlAttr::get(odsBuilder.getContext(), loop_control); (void)odsState.addRegion(); odsState.addTypes(results); } LoopOp LoopOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::spirv::LoopControl loop_control) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(results), std::forward(loop_control)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoopOp LoopOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::spirv::LoopControl loop_control) { return create(builder, builder.getLoc(), std::forward(results), std::forward(loop_control)); } void LoopOp::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); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } LoopOp LoopOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoopOp LoopOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void LoopOp::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)); odsState.addAttributes(discardableAttributes); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); odsState.addTypes(resultTypes); } LoopOp LoopOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } LoopOp LoopOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult LoopOp::verifyInvariantsImpl() { auto tblgen_loop_control = getProperties().loop_control; (void)tblgen_loop_control; if (!tblgen_loop_control) return emitOpError("requires attribute 'loop_control'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps27(*this, tblgen_loop_control, "loop_control"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps19(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); { unsigned index = 0; (void)index; for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) if (::mlir::failed(__mlir_ods_local_region_constraint_SPIRVOps1(*this, region, "body", index++))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult LoopOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult LoopOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.loop_control; auto loop_controlAttrName = ::mlir::StringAttr::get(ctx, "loop_control"); auto attr = dict.get(loop_controlAttrName); usedKeys.insert(loop_controlAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for loop_control in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `loop_control` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::LoopOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::LoopOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::MatrixTimesMatrixOp definitions //===----------------------------------------------------------------------===// namespace detail { MatrixTimesMatrixOpGenericAdaptorBase::MatrixTimesMatrixOpGenericAdaptorBase(MatrixTimesMatrixOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail MatrixTimesMatrixOpAdaptor::MatrixTimesMatrixOpAdaptor(MatrixTimesMatrixOp op) : MatrixTimesMatrixOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult MatrixTimesMatrixOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult MatrixTimesMatrixOp::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 MatrixTimesMatrixOp::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 MatrixTimesMatrixOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional MatrixTimesMatrixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void MatrixTimesMatrixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void MatrixTimesMatrixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult MatrixTimesMatrixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void MatrixTimesMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value leftmatrix, ::mlir::Value rightmatrix) { odsState.addOperands(leftmatrix); odsState.addOperands(rightmatrix); odsState.addTypes(result); } MatrixTimesMatrixOp MatrixTimesMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value leftmatrix, ::mlir::Value rightmatrix) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(leftmatrix), std::forward(rightmatrix)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesMatrixOp MatrixTimesMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value leftmatrix, ::mlir::Value rightmatrix) { return create(builder, builder.getLoc(), std::forward(result), std::forward(leftmatrix), std::forward(rightmatrix)); } void MatrixTimesMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value leftmatrix, ::mlir::Value rightmatrix) { odsState.addOperands(leftmatrix); odsState.addOperands(rightmatrix); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } MatrixTimesMatrixOp MatrixTimesMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value leftmatrix, ::mlir::Value rightmatrix) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(leftmatrix), std::forward(rightmatrix)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesMatrixOp MatrixTimesMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value leftmatrix, ::mlir::Value rightmatrix) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(leftmatrix), std::forward(rightmatrix)); } void MatrixTimesMatrixOp::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); } MatrixTimesMatrixOp MatrixTimesMatrixOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesMatrixOp MatrixTimesMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void MatrixTimesMatrixOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } MatrixTimesMatrixOp MatrixTimesMatrixOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesMatrixOp MatrixTimesMatrixOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult MatrixTimesMatrixOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps48(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps48(*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_SPIRVOps48(*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->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {leftmatrix, rightmatrix, result} have same element type"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(0).begin()).getType()).getNumColumns() == ::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(1).begin()).getType()).getNumRows()))) return emitOpError("failed to verify that leftmatrix columns count matches rightmatrix rows count"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(1).begin()).getType()).getNumColumns() == ::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSResults(0).begin()).getType()).getNumColumns()))) return emitOpError("failed to verify that rightmatrix columns count matches result columns count"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(0).begin()).getType()).getNumRows() == ::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSResults(0).begin()).getType()).getNumRows()))) return emitOpError("failed to verify that leftmatrix rows count matches result rows count"); return ::mlir::success(); } ::llvm::LogicalResult MatrixTimesMatrixOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult MatrixTimesMatrixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type leftmatrixRawType{}; ::llvm::ArrayRef<::mlir::Type> leftmatrixTypes(&leftmatrixRawType, 1); ::mlir::Type rightmatrixRawType{}; ::llvm::ArrayRef<::mlir::Type> rightmatrixTypes(&rightmatrixRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); leftmatrixRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); rightmatrixRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(leftmatrixTypes), ::llvm::ArrayRef<::mlir::Type>(rightmatrixTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void MatrixTimesMatrixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getLeftmatrix().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getRightmatrix().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 MatrixTimesMatrixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::MatrixTimesMatrixOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::MatrixTimesScalarOp definitions //===----------------------------------------------------------------------===// namespace detail { MatrixTimesScalarOpGenericAdaptorBase::MatrixTimesScalarOpGenericAdaptorBase(MatrixTimesScalarOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail MatrixTimesScalarOpAdaptor::MatrixTimesScalarOpAdaptor(MatrixTimesScalarOp op) : MatrixTimesScalarOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult MatrixTimesScalarOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult MatrixTimesScalarOp::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 MatrixTimesScalarOp::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 MatrixTimesScalarOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional MatrixTimesScalarOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void MatrixTimesScalarOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void MatrixTimesScalarOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult MatrixTimesScalarOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void MatrixTimesScalarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value matrix, ::mlir::Value scalar) { odsState.addOperands(matrix); odsState.addOperands(scalar); odsState.addTypes(result); } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value matrix, ::mlir::Value scalar) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(matrix), std::forward(scalar)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value matrix, ::mlir::Value scalar) { return create(builder, builder.getLoc(), std::forward(result), std::forward(matrix), std::forward(scalar)); } void MatrixTimesScalarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value matrix, ::mlir::Value scalar) { odsState.addOperands(matrix); odsState.addOperands(scalar); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(MatrixTimesScalarOp::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); } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value matrix, ::mlir::Value scalar) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(matrix), std::forward(scalar)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value matrix, ::mlir::Value scalar) { return create(builder, builder.getLoc(), std::forward(matrix), std::forward(scalar)); } void MatrixTimesScalarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value scalar) { odsState.addOperands(matrix); odsState.addOperands(scalar); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value scalar) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(matrix), std::forward(scalar)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value scalar) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(matrix), std::forward(scalar)); } void MatrixTimesScalarOp::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); } MatrixTimesScalarOp MatrixTimesScalarOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void MatrixTimesScalarOp::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(MatrixTimesScalarOp::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)."); } } MatrixTimesScalarOp MatrixTimesScalarOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void MatrixTimesScalarOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } MatrixTimesScalarOp MatrixTimesScalarOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesScalarOp MatrixTimesScalarOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void MatrixTimesScalarOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(MatrixTimesScalarOp::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)."); } } MatrixTimesScalarOp MatrixTimesScalarOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesScalarOp MatrixTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult MatrixTimesScalarOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps49(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps17(*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_SPIRVOps49(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {matrix, result} have same type"); 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 {matrix, scalar} have same element type"); return ::mlir::success(); } ::llvm::LogicalResult MatrixTimesScalarOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult MatrixTimesScalarOp::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 MatrixTimesScalarOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type matrixRawType{}; ::llvm::ArrayRef<::mlir::Type> matrixTypes(&matrixRawType, 1); ::mlir::Type scalarRawType{}; ::llvm::ArrayRef<::mlir::Type> scalarTypes(&scalarRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); matrixRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); scalarRawType = type; } result.addTypes(matrixTypes[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(matrixTypes), ::llvm::ArrayRef<::mlir::Type>(scalarTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void MatrixTimesScalarOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getMatrix().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getScalar().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void MatrixTimesScalarOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::MatrixTimesScalarOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::MatrixTimesVectorOp definitions //===----------------------------------------------------------------------===// namespace detail { MatrixTimesVectorOpGenericAdaptorBase::MatrixTimesVectorOpGenericAdaptorBase(MatrixTimesVectorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail MatrixTimesVectorOpAdaptor::MatrixTimesVectorOpAdaptor(MatrixTimesVectorOp op) : MatrixTimesVectorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult MatrixTimesVectorOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult MatrixTimesVectorOp::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 MatrixTimesVectorOp::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 MatrixTimesVectorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional MatrixTimesVectorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void MatrixTimesVectorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void MatrixTimesVectorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult MatrixTimesVectorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void MatrixTimesVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value matrix, ::mlir::Value vector) { odsState.addOperands(matrix); odsState.addOperands(vector); odsState.addTypes(result); } MatrixTimesVectorOp MatrixTimesVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value matrix, ::mlir::Value vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(matrix), std::forward(vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesVectorOp MatrixTimesVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value matrix, ::mlir::Value vector) { return create(builder, builder.getLoc(), std::forward(result), std::forward(matrix), std::forward(vector)); } void MatrixTimesVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value vector) { odsState.addOperands(matrix); odsState.addOperands(vector); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } MatrixTimesVectorOp MatrixTimesVectorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value vector) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(matrix), std::forward(vector)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesVectorOp MatrixTimesVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value vector) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(matrix), std::forward(vector)); } void MatrixTimesVectorOp::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); } MatrixTimesVectorOp MatrixTimesVectorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesVectorOp MatrixTimesVectorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void MatrixTimesVectorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } MatrixTimesVectorOp MatrixTimesVectorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MatrixTimesVectorOp MatrixTimesVectorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult MatrixTimesVectorOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps50(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps51(*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_SPIRVOps51(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {matrix, result} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin())))))) return emitOpError("failed to verify that all of {vector, result} have same element type"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(0).begin()).getType()).getNumColumns() == ::llvm::cast<::mlir::VectorType>((*this->getODSOperands(1).begin()).getType()).getNumElements()))) return emitOpError("failed to verify that matrix columns count matches vector elements count"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(0).begin()).getType()).getNumRows() == ::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getNumElements()))) return emitOpError("failed to verify that matrix rows count matches result elements count"); return ::mlir::success(); } ::llvm::LogicalResult MatrixTimesVectorOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult MatrixTimesVectorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type matrixRawType{}; ::llvm::ArrayRef<::mlir::Type> matrixTypes(&matrixRawType, 1); ::mlir::Type vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> vectorTypes(&vectorRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); matrixRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); vectorRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(matrixTypes), ::llvm::ArrayRef<::mlir::Type>(vectorTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void MatrixTimesVectorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getMatrix().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void MatrixTimesVectorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::MatrixTimesVectorOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::MemoryBarrierOp definitions //===----------------------------------------------------------------------===// namespace detail { MemoryBarrierOpGenericAdaptorBase::MemoryBarrierOpGenericAdaptorBase(MemoryBarrierOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope MemoryBarrierOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics MemoryBarrierOpGenericAdaptorBase::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } } // namespace detail MemoryBarrierOpAdaptor::MemoryBarrierOpAdaptor(MemoryBarrierOp op) : MemoryBarrierOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult MemoryBarrierOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.MemoryBarrier' op requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitError(loc, "'spirv.MemoryBarrier' op requires attribute 'memory_semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.MemoryBarrier' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_memory_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_memory_semantics)))) return emitError(loc, "'spirv.MemoryBarrier' op attribute 'memory_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult MemoryBarrierOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_semantics; auto attr = dict.get("memory_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute MemoryBarrierOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.memory_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code MemoryBarrierOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.memory_semantics.getAsOpaquePointer())); } std::optional MemoryBarrierOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "memory_semantics") return prop.memory_semantics; return std::nullopt; } void MemoryBarrierOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_semantics") { prop.memory_semantics = ::llvm::dyn_cast_or_null>(value); return; } } void MemoryBarrierOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.memory_semantics) attrs.append("memory_semantics", prop.memory_semantics); } ::llvm::LogicalResult MemoryBarrierOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemorySemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "memory_semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult MemoryBarrierOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_semantics))) return ::mlir::failure(); return ::mlir::success(); } void MemoryBarrierOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.memory_semantics); } ::mlir::spirv::Scope MemoryBarrierOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics MemoryBarrierOp::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } void MemoryBarrierOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void MemoryBarrierOp::setMemorySemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void MemoryBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; } MemoryBarrierOp MemoryBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryBarrierOp MemoryBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(memory_scope), std::forward(memory_semantics)); } void MemoryBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } MemoryBarrierOp MemoryBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryBarrierOp MemoryBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(memory_scope), std::forward(memory_semantics)); } void MemoryBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); } MemoryBarrierOp MemoryBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryBarrierOp MemoryBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(memory_scope), std::forward(memory_semantics)); } void MemoryBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } MemoryBarrierOp MemoryBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryBarrierOp MemoryBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(memory_scope), std::forward(memory_semantics)); } void MemoryBarrierOp::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(); ::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."); } } MemoryBarrierOp MemoryBarrierOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryBarrierOp MemoryBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void MemoryBarrierOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } MemoryBarrierOp MemoryBarrierOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryBarrierOp MemoryBarrierOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult MemoryBarrierOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitOpError("requires attribute 'memory_semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_memory_semantics, "memory_semantics"))) return ::mlir::failure(); return ::mlir::success(); } ::llvm::LogicalResult MemoryBarrierOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult MemoryBarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr memory_semanticsAttr; if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(memory_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_semanticsAttr) result.getOrAddProperties().memory_semantics = memory_semanticsAttr; { 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 MemoryBarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemorySemanticsAttr()); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("memory_semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::MemoryBarrierOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::MemoryBarrierOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::MemoryNamedBarrierOp definitions //===----------------------------------------------------------------------===// namespace detail { MemoryNamedBarrierOpGenericAdaptorBase::MemoryNamedBarrierOpGenericAdaptorBase(MemoryNamedBarrierOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::Scope MemoryNamedBarrierOpGenericAdaptorBase::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics MemoryNamedBarrierOpGenericAdaptorBase::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } } // namespace detail MemoryNamedBarrierOpAdaptor::MemoryNamedBarrierOpAdaptor(MemoryNamedBarrierOp op) : MemoryNamedBarrierOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult MemoryNamedBarrierOpAdaptor::verify(::mlir::Location loc) { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitError(loc, "'spirv.MemoryNamedBarrier' op requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitError(loc, "'spirv.MemoryNamedBarrier' op requires attribute 'memory_semantics'"); if (tblgen_memory_scope && !((::llvm::isa<::mlir::spirv::ScopeAttr>(tblgen_memory_scope)))) return emitError(loc, "'spirv.MemoryNamedBarrier' op attribute 'memory_scope' failed to satisfy constraint: valid SPIR-V Scope"); if (tblgen_memory_semantics && !((::llvm::isa<::mlir::spirv::MemorySemanticsAttr>(tblgen_memory_semantics)))) return emitError(loc, "'spirv.MemoryNamedBarrier' op attribute 'memory_semantics' failed to satisfy constraint: valid SPIR-V MemorySemantics"); return ::mlir::success(); } ::llvm::LogicalResult MemoryNamedBarrierOp::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.memory_scope; auto attr = dict.get("memory_scope"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_scope` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_semantics; auto attr = dict.get("memory_semantics"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_semantics` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute MemoryNamedBarrierOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.memory_scope; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_scope", propStorage)); } { const auto &propStorage = prop.memory_semantics; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_semantics", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code MemoryNamedBarrierOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.memory_scope.getAsOpaquePointer()), llvm::hash_value(prop.memory_semantics.getAsOpaquePointer())); } std::optional MemoryNamedBarrierOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "memory_scope") return prop.memory_scope; if (name == "memory_semantics") return prop.memory_semantics; return std::nullopt; } void MemoryNamedBarrierOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "memory_scope") { prop.memory_scope = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_semantics") { prop.memory_semantics = ::llvm::dyn_cast_or_null>(value); return; } } void MemoryNamedBarrierOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.memory_scope) attrs.append("memory_scope", prop.memory_scope); if (prop.memory_semantics) attrs.append("memory_semantics", prop.memory_semantics); } ::llvm::LogicalResult MemoryNamedBarrierOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMemoryScopeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(attr, "memory_scope", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemorySemanticsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(attr, "memory_semantics", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult MemoryNamedBarrierOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.memory_scope))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_semantics))) return ::mlir::failure(); return ::mlir::success(); } void MemoryNamedBarrierOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.memory_scope); writer.writeAttribute(prop.memory_semantics); } ::mlir::spirv::Scope MemoryNamedBarrierOp::getMemoryScope() { auto attr = getMemoryScopeAttr(); return attr.getValue(); } ::mlir::spirv::MemorySemantics MemoryNamedBarrierOp::getMemorySemantics() { auto attr = getMemorySemanticsAttr(); return attr.getValue(); } void MemoryNamedBarrierOp::setMemoryScope(::mlir::spirv::Scope attrValue) { getProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void MemoryNamedBarrierOp::setMemorySemantics(::mlir::spirv::MemorySemantics attrValue) { getProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void MemoryNamedBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value named_barrier, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.addOperands(named_barrier); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value named_barrier, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(named_barrier), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value named_barrier, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(named_barrier), std::forward(memory_scope), std::forward(memory_semantics)); } void MemoryNamedBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value named_barrier, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { odsState.addOperands(named_barrier); odsState.getOrAddProperties().memory_scope = memory_scope; odsState.getOrAddProperties().memory_semantics = memory_semantics; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value named_barrier, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(named_barrier), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value named_barrier, ::mlir::spirv::ScopeAttr memory_scope, ::mlir::spirv::MemorySemanticsAttr memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(named_barrier), std::forward(memory_scope), std::forward(memory_semantics)); } void MemoryNamedBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value named_barrier, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.addOperands(named_barrier); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value named_barrier, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(named_barrier), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value named_barrier, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(named_barrier), std::forward(memory_scope), std::forward(memory_semantics)); } void MemoryNamedBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value named_barrier, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { odsState.addOperands(named_barrier); odsState.getOrAddProperties().memory_scope = ::mlir::spirv::ScopeAttr::get(odsBuilder.getContext(), memory_scope); odsState.getOrAddProperties().memory_semantics = ::mlir::spirv::MemorySemanticsAttr::get(odsBuilder.getContext(), memory_semantics); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value named_barrier, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(named_barrier), std::forward(memory_scope), std::forward(memory_semantics)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value named_barrier, ::mlir::spirv::Scope memory_scope, ::mlir::spirv::MemorySemantics memory_semantics) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(named_barrier), std::forward(memory_scope), std::forward(memory_semantics)); } void MemoryNamedBarrierOp::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(); ::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."); } } MemoryNamedBarrierOp MemoryNamedBarrierOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryNamedBarrierOp MemoryNamedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void MemoryNamedBarrierOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } MemoryNamedBarrierOp MemoryNamedBarrierOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MemoryNamedBarrierOp MemoryNamedBarrierOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult MemoryNamedBarrierOp::verifyInvariantsImpl() { auto tblgen_memory_scope = getProperties().memory_scope; (void)tblgen_memory_scope; if (!tblgen_memory_scope) return emitOpError("requires attribute 'memory_scope'"); auto tblgen_memory_semantics = getProperties().memory_semantics; (void)tblgen_memory_semantics; if (!tblgen_memory_semantics) return emitOpError("requires attribute 'memory_semantics'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps2(*this, tblgen_memory_scope, "memory_scope"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps3(*this, tblgen_memory_semantics, "memory_semantics"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps52(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult MemoryNamedBarrierOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult MemoryNamedBarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand named_barrierRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> named_barrierOperands(&named_barrierRawOperand, 1); ::llvm::SMLoc named_barrierOperandsLoc; (void)named_barrierOperandsLoc; ::mlir::spirv::ScopeAttr memory_scopeAttr; ::mlir::spirv::MemorySemanticsAttr memory_semanticsAttr; ::mlir::Type named_barrierRawType{}; ::llvm::ArrayRef<::mlir::Type> named_barrierTypes(&named_barrierRawType, 1); named_barrierOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(named_barrierRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(memory_scopeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_scopeAttr) result.getOrAddProperties().memory_scope = memory_scopeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(memory_semanticsAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (memory_semanticsAttr) result.getOrAddProperties().memory_semantics = memory_semanticsAttr; { 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(); named_barrierRawType = type; } if (parser.resolveOperands(named_barrierOperands, named_barrierTypes, named_barrierOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void MemoryNamedBarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getNamedBarrier(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemoryScopeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getMemorySemanticsAttr()); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("memory_scope"); elidedAttrs.push_back("memory_semantics"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getNamedBarrier().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::MemoryNamedBarrierOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::MemoryNamedBarrierOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::MergeOp definitions //===----------------------------------------------------------------------===// namespace detail { MergeOpGenericAdaptorBase::MergeOpGenericAdaptorBase(MergeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair MergeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {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 - 0) / 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 MergeOpAdaptor::MergeOpAdaptor(MergeOp op) : MergeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult MergeOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair MergeOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {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() - 0) / 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 MergeOp::getOperandsMutable() { auto range = getODSOperandIndexAndLength(0); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult MergeOp::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 MergeOp::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 MergeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional MergeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void MergeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void MergeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult MergeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void MergeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { build(odsBuilder, odsState, ValueRange()); } MergeOp MergeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MergeOp MergeOp::create(::mlir::ImplicitLocOpBuilder &builder) { return create(builder, builder.getLoc()); } void MergeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { odsState.addOperands(operands); } MergeOp MergeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operands)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MergeOp MergeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands) { return create(builder, builder.getLoc(), std::forward(operands)); } void MergeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { odsState.addOperands(operands); odsState.addAttributes(attributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } MergeOp MergeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MergeOp MergeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void MergeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { odsState.addOperands(operands); odsState.useProperties(const_cast(properties)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } MergeOp MergeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } MergeOp MergeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult MergeOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps19(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult MergeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult MergeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; ::llvm::SMLoc operandsOperandsLoc; (void)operandsOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; { 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(); } operandsOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(operandsOperands)) return ::mlir::failure(); if (!operandsOperands.empty()) { if (parser.parseColon()) return ::mlir::failure(); if (parser.parseTypeList(operandsTypes)) return ::mlir::failure(); } if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void MergeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); if (!getOperands().empty()) { _odsPrinter << ' '; _odsPrinter << getOperands(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperands().getTypes(); } } void MergeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::MergeOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ModuleOp definitions //===----------------------------------------------------------------------===// namespace detail { ModuleOpGenericAdaptorBase::ModuleOpGenericAdaptorBase(ModuleOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::AddressingModel ModuleOpGenericAdaptorBase::getAddressingModel() { auto attr = getAddressingModelAttr(); return attr.getValue(); } ::mlir::spirv::MemoryModel ModuleOpGenericAdaptorBase::getMemoryModel() { auto attr = getMemoryModelAttr(); return attr.getValue(); } ::std::optional<::mlir::spirv::VerCapExtAttr> ModuleOpGenericAdaptorBase::getVceTriple() { auto attr = getVceTripleAttr(); return attr ? ::std::optional<::mlir::spirv::VerCapExtAttr>(attr) : (::std::nullopt); } ::std::optional< ::llvm::StringRef > ModuleOpGenericAdaptorBase::getSymName() { auto attr = getSymNameAttr(); return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); } } // namespace detail ModuleOpAdaptor::ModuleOpAdaptor(ModuleOp op) : ModuleOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ModuleOpAdaptor::verify(::mlir::Location loc) { auto tblgen_addressing_model = getProperties().addressing_model; (void)tblgen_addressing_model; if (!tblgen_addressing_model) return emitError(loc, "'spirv.module' op requires attribute 'addressing_model'"); auto tblgen_memory_model = getProperties().memory_model; (void)tblgen_memory_model; if (!tblgen_memory_model) return emitError(loc, "'spirv.module' op requires attribute 'memory_model'"); auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; auto tblgen_vce_triple = getProperties().vce_triple; (void)tblgen_vce_triple; if (tblgen_addressing_model && !((::llvm::isa<::mlir::spirv::AddressingModelAttr>(tblgen_addressing_model)))) return emitError(loc, "'spirv.module' op attribute 'addressing_model' failed to satisfy constraint: valid SPIR-V AddressingModel"); if (tblgen_memory_model && !((::llvm::isa<::mlir::spirv::MemoryModelAttr>(tblgen_memory_model)))) return emitError(loc, "'spirv.module' op attribute 'memory_model' failed to satisfy constraint: valid SPIR-V MemoryModel"); if (tblgen_vce_triple && !((::llvm::isa<::mlir::spirv::VerCapExtAttr>(tblgen_vce_triple)))) return emitError(loc, "'spirv.module' op attribute 'vce_triple' failed to satisfy constraint: version-capability-extension attribute"); if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) return emitError(loc, "'spirv.module' op attribute 'sym_name' failed to satisfy constraint: string attribute"); return ::mlir::success(); } ::llvm::LogicalResult ModuleOp::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.addressing_model; auto attr = dict.get("addressing_model"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `addressing_model` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_model; auto attr = dict.get("memory_model"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_model` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto attr = dict.get("sym_name"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.vce_triple; auto attr = dict.get("vce_triple"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `vce_triple` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ModuleOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.addressing_model; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("addressing_model", propStorage)); } { const auto &propStorage = prop.memory_model; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_model", propStorage)); } { const auto &propStorage = prop.sym_name; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("sym_name", propStorage)); } { const auto &propStorage = prop.vce_triple; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("vce_triple", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ModuleOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.addressing_model.getAsOpaquePointer()), llvm::hash_value(prop.memory_model.getAsOpaquePointer()), llvm::hash_value(prop.sym_name.getAsOpaquePointer()), llvm::hash_value(prop.vce_triple.getAsOpaquePointer())); } std::optional ModuleOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "addressing_model") return prop.addressing_model; if (name == "memory_model") return prop.memory_model; if (name == "sym_name") return prop.sym_name; if (name == "vce_triple") return prop.vce_triple; return std::nullopt; } void ModuleOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "addressing_model") { prop.addressing_model = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_model") { prop.memory_model = ::llvm::dyn_cast_or_null>(value); return; } if (name == "sym_name") { prop.sym_name = ::llvm::dyn_cast_or_null>(value); return; } if (name == "vce_triple") { prop.vce_triple = ::llvm::dyn_cast_or_null>(value); return; } } void ModuleOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.addressing_model) attrs.append("addressing_model", prop.addressing_model); if (prop.memory_model) attrs.append("memory_model", prop.memory_model); if (prop.sym_name) attrs.append("sym_name", prop.sym_name); if (prop.vce_triple) attrs.append("vce_triple", prop.vce_triple); } ::llvm::LogicalResult ModuleOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAddressingModelAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps28(attr, "addressing_model", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryModelAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps29(attr, "memory_model", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(attr, "sym_name", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getVceTripleAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps30(attr, "vce_triple", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ModuleOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.addressing_model))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.memory_model))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.sym_name))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.vce_triple))) return ::mlir::failure(); return ::mlir::success(); } void ModuleOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.addressing_model); writer.writeAttribute(prop.memory_model); writer.writeOptionalAttribute(prop.sym_name); writer.writeOptionalAttribute(prop.vce_triple); } ::mlir::spirv::AddressingModel ModuleOp::getAddressingModel() { auto attr = getAddressingModelAttr(); return attr.getValue(); } ::mlir::spirv::MemoryModel ModuleOp::getMemoryModel() { auto attr = getMemoryModelAttr(); return attr.getValue(); } ::std::optional<::mlir::spirv::VerCapExtAttr> ModuleOp::getVceTriple() { auto attr = getVceTripleAttr(); return attr ? ::std::optional<::mlir::spirv::VerCapExtAttr>(attr) : (::std::nullopt); } ::std::optional< ::llvm::StringRef > ModuleOp::getSymName() { auto attr = getSymNameAttr(); return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); } void ModuleOp::setAddressingModel(::mlir::spirv::AddressingModel attrValue) { getProperties().addressing_model = ::mlir::spirv::AddressingModelAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ModuleOp::setMemoryModel(::mlir::spirv::MemoryModel attrValue) { getProperties().memory_model = ::mlir::spirv::MemoryModelAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ModuleOp::setSymName(::std::optional<::llvm::StringRef> attrValue) { auto &odsProp = getProperties().sym_name; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue); else odsProp = nullptr; } ModuleOp ModuleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, std::optional name) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(name)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ModuleOp ModuleOp::create(::mlir::ImplicitLocOpBuilder &builder, std::optional name) { return create(builder, builder.getLoc(), std::forward(name)); } ModuleOp ModuleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, spirv::AddressingModel addressing_model, spirv::MemoryModel memory_model, std::optional vce_triple, std::optional name) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(addressing_model), std::forward(memory_model), std::forward(vce_triple), std::forward(name)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ModuleOp ModuleOp::create(::mlir::ImplicitLocOpBuilder &builder, spirv::AddressingModel addressing_model, spirv::MemoryModel memory_model, std::optional vce_triple, std::optional name) { return create(builder, builder.getLoc(), std::forward(addressing_model), std::forward(memory_model), std::forward(vce_triple), std::forward(name)); } ::llvm::LogicalResult ModuleOp::verifyInvariantsImpl() { auto tblgen_addressing_model = getProperties().addressing_model; (void)tblgen_addressing_model; if (!tblgen_addressing_model) return emitOpError("requires attribute 'addressing_model'"); auto tblgen_memory_model = getProperties().memory_model; (void)tblgen_memory_model; if (!tblgen_memory_model) return emitOpError("requires attribute 'memory_model'"); auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; auto tblgen_vce_triple = getProperties().vce_triple; (void)tblgen_vce_triple; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps28(*this, tblgen_addressing_model, "addressing_model"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps29(*this, tblgen_memory_model, "memory_model"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps30(*this, tblgen_vce_triple, "vce_triple"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(*this, tblgen_sym_name, "sym_name"))) return ::mlir::failure(); { unsigned index = 0; (void)index; for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) if (::mlir::failed(__mlir_ods_local_region_constraint_SPIRVOps1(*this, region, "", index++))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ModuleOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult ModuleOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.addressing_model; auto addressing_modelAttrName = ::mlir::StringAttr::get(ctx, "addressing_model"); auto attr = dict.get(addressing_modelAttrName); usedKeys.insert(addressing_modelAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for addressing_model in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `addressing_model` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_model; auto memory_modelAttrName = ::mlir::StringAttr::get(ctx, "memory_model"); auto attr = dict.get(memory_modelAttrName); usedKeys.insert(memory_modelAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for memory_model in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_model` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.vce_triple; auto vce_tripleAttrName = ::mlir::StringAttr::get(ctx, "vce_triple"); auto attr = dict.get(vce_tripleAttrName); usedKeys.insert(vce_tripleAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for vce_triple in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `vce_triple` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name"); auto attr = dict.get(sym_nameAttrName); usedKeys.insert(sym_nameAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for sym_name in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ModuleOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ModuleOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::NamedBarrierInitializeOp definitions //===----------------------------------------------------------------------===// namespace detail { NamedBarrierInitializeOpGenericAdaptorBase::NamedBarrierInitializeOpGenericAdaptorBase(NamedBarrierInitializeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail NamedBarrierInitializeOpAdaptor::NamedBarrierInitializeOpAdaptor(NamedBarrierInitializeOp op) : NamedBarrierInitializeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult NamedBarrierInitializeOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult NamedBarrierInitializeOp::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 NamedBarrierInitializeOp::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 NamedBarrierInitializeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional NamedBarrierInitializeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void NamedBarrierInitializeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void NamedBarrierInitializeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult NamedBarrierInitializeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void NamedBarrierInitializeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value subgroup_count) { odsState.addOperands(subgroup_count); odsState.addTypes(result); } NamedBarrierInitializeOp NamedBarrierInitializeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value subgroup_count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(subgroup_count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NamedBarrierInitializeOp NamedBarrierInitializeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value subgroup_count) { return create(builder, builder.getLoc(), std::forward(result), std::forward(subgroup_count)); } void NamedBarrierInitializeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value subgroup_count) { odsState.addOperands(subgroup_count); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } NamedBarrierInitializeOp NamedBarrierInitializeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value subgroup_count) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(subgroup_count)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NamedBarrierInitializeOp NamedBarrierInitializeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value subgroup_count) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(subgroup_count)); } void NamedBarrierInitializeOp::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); } NamedBarrierInitializeOp NamedBarrierInitializeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NamedBarrierInitializeOp NamedBarrierInitializeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void NamedBarrierInitializeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } NamedBarrierInitializeOp NamedBarrierInitializeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NamedBarrierInitializeOp NamedBarrierInitializeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult NamedBarrierInitializeOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps27(*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_SPIRVOps52(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult NamedBarrierInitializeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult NamedBarrierInitializeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand subgroup_countRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> subgroup_countOperands(&subgroup_countRawOperand, 1); ::llvm::SMLoc subgroup_countOperandsLoc; (void)subgroup_countOperandsLoc; ::mlir::Type subgroup_countRawType{}; ::llvm::ArrayRef<::mlir::Type> subgroup_countTypes(&subgroup_countRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); subgroup_countOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(subgroup_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::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); subgroup_countRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(subgroup_countOperands, subgroup_countTypes, subgroup_countOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void NamedBarrierInitializeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getSubgroupCount(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getSubgroupCount().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(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; } } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::NamedBarrierInitializeOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::NotOp definitions //===----------------------------------------------------------------------===// namespace detail { NotOpGenericAdaptorBase::NotOpGenericAdaptorBase(NotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail NotOpAdaptor::NotOpAdaptor(NotOp op) : NotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult NotOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult NotOp::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 NotOp::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 NotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional NotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void NotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void NotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult NotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void NotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } NotOp NotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NotOp NotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void NotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(NotOp::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); } NotOp NotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NotOp NotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void NotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } NotOp NotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NotOp NotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void NotOp::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); } NotOp NotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NotOp NotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void NotOp::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(NotOp::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)."); } } NotOp NotOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NotOp NotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void NotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } NotOp NotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NotOp NotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void NotOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(NotOp::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)."); } } NotOp NotOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } NotOp NotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult NotOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult NotOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult NotOp::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 NotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } { 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(); } result.addTypes(operandTypes[0]); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void NotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void NotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::NotOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::OrderedOp definitions //===----------------------------------------------------------------------===// namespace detail { OrderedOpGenericAdaptorBase::OrderedOpGenericAdaptorBase(OrderedOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail OrderedOpAdaptor::OrderedOpAdaptor(OrderedOp op) : OrderedOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult OrderedOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult OrderedOp::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 OrderedOp::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 OrderedOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional OrderedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void OrderedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void OrderedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult OrderedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void OrderedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } OrderedOp OrderedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OrderedOp OrderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void OrderedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(OrderedOp::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); } OrderedOp OrderedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OrderedOp OrderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void OrderedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } OrderedOp OrderedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OrderedOp OrderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void OrderedOp::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); } OrderedOp OrderedOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OrderedOp OrderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void OrderedOp::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(OrderedOp::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)."); } } OrderedOp OrderedOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OrderedOp OrderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void OrderedOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } OrderedOp OrderedOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OrderedOp OrderedOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void OrderedOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(OrderedOp::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)."); } } OrderedOp OrderedOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OrderedOp OrderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult OrderedOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult OrderedOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult OrderedOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult OrderedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void OrderedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void OrderedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::OrderedOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::OuterProductOp definitions //===----------------------------------------------------------------------===// namespace detail { OuterProductOpGenericAdaptorBase::OuterProductOpGenericAdaptorBase(OuterProductOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail OuterProductOpAdaptor::OuterProductOpAdaptor(OuterProductOp op) : OuterProductOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult OuterProductOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult OuterProductOp::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 OuterProductOp::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 OuterProductOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional OuterProductOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void OuterProductOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void OuterProductOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult OuterProductOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void OuterProductOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addTypes(result); } OuterProductOp OuterProductOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OuterProductOp OuterProductOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2)); } void OuterProductOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2) { odsState.addOperands(vector1); odsState.addOperands(vector2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } OuterProductOp OuterProductOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OuterProductOp OuterProductOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2)); } void OuterProductOp::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); } OuterProductOp OuterProductOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OuterProductOp OuterProductOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void OuterProductOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } OuterProductOp OuterProductOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } OuterProductOp OuterProductOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult OuterProductOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps51(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps51(*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_SPIRVOps50(*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->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {vector1, vector2, result} have same element type"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSResults(0).begin()).getType()).getNumRows() == ::llvm::cast<::mlir::VectorType>((*this->getODSOperands(0).begin()).getType()).getNumElements()))) return emitOpError("failed to verify that result rows count matches vector1 elements count"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSResults(0).begin()).getType()).getNumColumns() == ::llvm::cast<::mlir::VectorType>((*this->getODSOperands(1).begin()).getType()).getNumElements()))) return emitOpError("failed to verify that result columns count matches vector2 elements count"); return ::mlir::success(); } ::llvm::LogicalResult OuterProductOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult OuterProductOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type vector2RawType{}; ::llvm::ArrayRef<::mlir::Type> vector2Types(&vector2RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); vector1RawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); vector2RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(vector1Types), ::llvm::ArrayRef<::mlir::Type>(vector2Types)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void OuterProductOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getVector2().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(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 OuterProductOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::OuterProductOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::PtrAccessChainOp definitions //===----------------------------------------------------------------------===// namespace detail { PtrAccessChainOpGenericAdaptorBase::PtrAccessChainOpGenericAdaptorBase(PtrAccessChainOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair PtrAccessChainOpGenericAdaptorBase::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}; } } // namespace detail PtrAccessChainOpAdaptor::PtrAccessChainOpAdaptor(PtrAccessChainOp op) : PtrAccessChainOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult PtrAccessChainOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } std::pair PtrAccessChainOp::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 PtrAccessChainOp::getIndicesMutable() { auto range = getODSOperandIndexAndLength(2); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult PtrAccessChainOp::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 PtrAccessChainOp::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 PtrAccessChainOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional PtrAccessChainOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void PtrAccessChainOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void PtrAccessChainOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult PtrAccessChainOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } PtrAccessChainOp PtrAccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value basePtr, Value element, ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(basePtr), std::forward(element), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrAccessChainOp PtrAccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, Value basePtr, Value element, ValueRange indices) { return create(builder, builder.getLoc(), std::forward(basePtr), std::forward(element), std::forward(indices)); } void PtrAccessChainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { odsState.addOperands(base_ptr); odsState.addOperands(element); odsState.addOperands(indices); odsState.addTypes(result); } PtrAccessChainOp PtrAccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(base_ptr), std::forward(element), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrAccessChainOp PtrAccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { return create(builder, builder.getLoc(), std::forward(result), std::forward(base_ptr), std::forward(element), std::forward(indices)); } void PtrAccessChainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { odsState.addOperands(base_ptr); odsState.addOperands(element); odsState.addOperands(indices); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } PtrAccessChainOp PtrAccessChainOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(base_ptr), std::forward(element), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrAccessChainOp PtrAccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base_ptr, ::mlir::Value element, ::mlir::ValueRange indices) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(base_ptr), std::forward(element), std::forward(indices)); } void PtrAccessChainOp::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); } PtrAccessChainOp PtrAccessChainOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrAccessChainOp PtrAccessChainOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void PtrAccessChainOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } PtrAccessChainOp PtrAccessChainOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrAccessChainOp PtrAccessChainOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult PtrAccessChainOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps2(*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_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult PtrAccessChainOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult PtrAccessChainOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand base_ptrRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> base_ptrOperands(&base_ptrRawOperand, 1); ::llvm::SMLoc base_ptrOperandsLoc; (void)base_ptrOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand elementRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> elementOperands(&elementRawOperand, 1); ::llvm::SMLoc elementOperandsLoc; (void)elementOperandsLoc; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; ::llvm::SMLoc indicesOperandsLoc; (void)indicesOperandsLoc; ::mlir::Type base_ptrRawType{}; ::llvm::ArrayRef<::mlir::Type> base_ptrTypes(&base_ptrRawType, 1); ::mlir::Type elementRawType{}; ::llvm::ArrayRef<::mlir::Type> elementTypes(&elementRawType, 1); ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); base_ptrOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(base_ptrRawOperand)) return ::mlir::failure(); if (parser.parseLSquare()) return ::mlir::failure(); elementOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(elementRawOperand)) return ::mlir::failure(); indicesOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(indicesOperands)) return ::mlir::failure(); if (!indicesOperands.empty()) { } 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::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); base_ptrRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); elementRawType = 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(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(base_ptrOperands, base_ptrTypes, base_ptrOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(elementOperands, elementTypes, elementOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void PtrAccessChainOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getBasePtr(); _odsPrinter << "["; _odsPrinter << getElement(); if (!getIndices().empty()) { _odsPrinter << ' '; _odsPrinter << getIndices(); } _odsPrinter << "]"; ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getBasePtr().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getElement().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } if (!getIndices().empty()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getIndices().getTypes(); } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void PtrAccessChainOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::PtrAccessChainOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::PtrCastToGenericOp definitions //===----------------------------------------------------------------------===// namespace detail { PtrCastToGenericOpGenericAdaptorBase::PtrCastToGenericOpGenericAdaptorBase(PtrCastToGenericOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail PtrCastToGenericOpAdaptor::PtrCastToGenericOpAdaptor(PtrCastToGenericOp op) : PtrCastToGenericOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult PtrCastToGenericOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult PtrCastToGenericOp::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 PtrCastToGenericOp::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 PtrCastToGenericOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional PtrCastToGenericOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void PtrCastToGenericOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void PtrCastToGenericOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult PtrCastToGenericOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void PtrCastToGenericOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer) { odsState.addOperands(pointer); odsState.addTypes(result); } PtrCastToGenericOp PtrCastToGenericOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(pointer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrCastToGenericOp PtrCastToGenericOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer) { return create(builder, builder.getLoc(), std::forward(result), std::forward(pointer)); } void PtrCastToGenericOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { odsState.addOperands(pointer); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } PtrCastToGenericOp PtrCastToGenericOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pointer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrCastToGenericOp PtrCastToGenericOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pointer)); } void PtrCastToGenericOp::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); } PtrCastToGenericOp PtrCastToGenericOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrCastToGenericOp PtrCastToGenericOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void PtrCastToGenericOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } PtrCastToGenericOp PtrCastToGenericOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } PtrCastToGenericOp PtrCastToGenericOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult PtrCastToGenericOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*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_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult PtrCastToGenericOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult PtrCastToGenericOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand pointerRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pointerOperands(&pointerRawOperand, 1); ::llvm::SMLoc pointerOperandsLoc; (void)pointerOperandsLoc; ::mlir::Type pointerRawType{}; ::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); pointerOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(pointerRawOperand)) 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(); pointerRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(pointerOperands, pointerTypes, pointerOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void PtrCastToGenericOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getPointer(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getPointer().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void PtrCastToGenericOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::PtrCastToGenericOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ReferenceOfOp definitions //===----------------------------------------------------------------------===// namespace detail { ReferenceOfOpGenericAdaptorBase::ReferenceOfOpGenericAdaptorBase(ReferenceOfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::llvm::StringRef ReferenceOfOpGenericAdaptorBase::getSpecConst() { auto attr = getSpecConstAttr(); return attr.getValue(); } } // namespace detail ReferenceOfOpAdaptor::ReferenceOfOpAdaptor(ReferenceOfOp op) : ReferenceOfOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ReferenceOfOpAdaptor::verify(::mlir::Location loc) { auto tblgen_spec_const = getProperties().spec_const; (void)tblgen_spec_const; if (!tblgen_spec_const) return emitError(loc, "'spirv.mlir.referenceof' op requires attribute 'spec_const'"); if (tblgen_spec_const && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_spec_const)))) return emitError(loc, "'spirv.mlir.referenceof' op attribute 'spec_const' failed to satisfy constraint: flat symbol reference attribute"); return ::mlir::success(); } ::llvm::LogicalResult ReferenceOfOp::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.spec_const; auto attr = dict.get("spec_const"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `spec_const` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute ReferenceOfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.spec_const; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("spec_const", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code ReferenceOfOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.spec_const.getAsOpaquePointer())); } std::optional ReferenceOfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "spec_const") return prop.spec_const; return std::nullopt; } void ReferenceOfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "spec_const") { prop.spec_const = ::llvm::dyn_cast_or_null>(value); return; } } void ReferenceOfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.spec_const) attrs.append("spec_const", prop.spec_const); } ::llvm::LogicalResult ReferenceOfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getSpecConstAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(attr, "spec_const", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult ReferenceOfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.spec_const))) return ::mlir::failure(); return ::mlir::success(); } void ReferenceOfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.spec_const); } ::llvm::StringRef ReferenceOfOp::getSpecConst() { auto attr = getSpecConstAttr(); return attr.getValue(); } void ReferenceOfOp::setSpecConst(::llvm::StringRef attrValue) { getProperties().spec_const = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void ReferenceOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type reference, ::mlir::FlatSymbolRefAttr spec_const) { odsState.getOrAddProperties().spec_const = spec_const; odsState.addTypes(reference); } ReferenceOfOp ReferenceOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type reference, ::mlir::FlatSymbolRefAttr spec_const) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(reference), std::forward(spec_const)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReferenceOfOp ReferenceOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type reference, ::mlir::FlatSymbolRefAttr spec_const) { return create(builder, builder.getLoc(), std::forward(reference), std::forward(spec_const)); } void ReferenceOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr spec_const) { odsState.getOrAddProperties().spec_const = spec_const; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ReferenceOfOp ReferenceOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr spec_const) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(spec_const)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReferenceOfOp ReferenceOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr spec_const) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(spec_const)); } void ReferenceOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type reference, ::llvm::StringRef spec_const) { odsState.getOrAddProperties().spec_const = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), spec_const); odsState.addTypes(reference); } ReferenceOfOp ReferenceOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type reference, ::llvm::StringRef spec_const) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(reference), std::forward(spec_const)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReferenceOfOp ReferenceOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type reference, ::llvm::StringRef spec_const) { return create(builder, builder.getLoc(), std::forward(reference), std::forward(spec_const)); } void ReferenceOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef spec_const) { odsState.getOrAddProperties().spec_const = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), spec_const); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ReferenceOfOp ReferenceOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef spec_const) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(spec_const)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReferenceOfOp ReferenceOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef spec_const) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(spec_const)); } void ReferenceOfOp::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() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } ReferenceOfOp ReferenceOfOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReferenceOfOp ReferenceOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ReferenceOfOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ReferenceOfOp ReferenceOfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReferenceOfOp ReferenceOfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ReferenceOfOp::verifyInvariantsImpl() { auto tblgen_spec_const = getProperties().spec_const; (void)tblgen_spec_const; if (!tblgen_spec_const) return emitOpError("requires attribute 'spec_const'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps1(*this, tblgen_spec_const, "spec_const"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult ReferenceOfOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ReferenceOfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::FlatSymbolRefAttr spec_constAttr; ::mlir::Type referenceRawType{}; ::llvm::ArrayRef<::mlir::Type> referenceTypes(&referenceRawType, 1); if (parser.parseCustomAttributeWithFallback(spec_constAttr, parser.getBuilder().getType<::mlir::NoneType>())) { return ::mlir::failure(); } if (spec_constAttr) result.getOrAddProperties().spec_const = spec_constAttr; { 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(); referenceRawType = type; } result.addTypes(referenceTypes); return ::mlir::success(); } void ReferenceOfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getSpecConstAttr()); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("spec_const"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getReference().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ReferenceOfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ReferenceOfOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::ReferenceOfOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ReturnOp definitions //===----------------------------------------------------------------------===// namespace detail { ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ReturnOpAdaptor::ReturnOpAdaptor(ReturnOp op) : ReturnOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ReturnOp::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 ReturnOp::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 ReturnOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ReturnOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ReturnOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ReturnOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ReturnOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { } ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder) { return create(builder, builder.getLoc()); } void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) { return create(builder, builder.getLoc(), std::forward(resultTypes)); } void ReturnOp::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); } ReturnOp ReturnOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ReturnOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ReturnOp ReturnOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReturnOp ReturnOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ReturnOp::verifyInvariantsImpl() { if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult ReturnOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ReturnOp::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 ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ReturnOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ReturnValueOp definitions //===----------------------------------------------------------------------===// namespace detail { ReturnValueOpGenericAdaptorBase::ReturnValueOpGenericAdaptorBase(ReturnValueOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ReturnValueOpAdaptor::ReturnValueOpAdaptor(ReturnValueOp op) : ReturnValueOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ReturnValueOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ReturnValueOp::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 ReturnValueOp::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 ReturnValueOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ReturnValueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ReturnValueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ReturnValueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ReturnValueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ReturnValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value) { odsState.addOperands(value); } ReturnValueOp ReturnValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReturnValueOp ReturnValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(value)); } void ReturnValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { odsState.addOperands(value); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } ReturnValueOp ReturnValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReturnValueOp ReturnValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(value)); } void ReturnValueOp::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); } ReturnValueOp ReturnValueOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReturnValueOp ReturnValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ReturnValueOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ReturnValueOp ReturnValueOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ReturnValueOp ReturnValueOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ReturnValueOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps12(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult ReturnValueOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult ReturnValueOp::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::Type valueRawType{}; ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1); valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valueRawOperand)) 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(); valueRawType = type; } if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ReturnValueOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getValue(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getValue().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ReturnValueOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ReturnValueOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SConvertOp definitions //===----------------------------------------------------------------------===// namespace detail { SConvertOpGenericAdaptorBase::SConvertOpGenericAdaptorBase(SConvertOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SConvertOpAdaptor::SConvertOpAdaptor(SConvertOp op) : SConvertOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SConvertOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SConvertOp::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 SConvertOp::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 SConvertOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SConvertOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SConvertOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SConvertOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SConvertOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SConvertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } SConvertOp SConvertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SConvertOp SConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void SConvertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SConvertOp SConvertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SConvertOp SConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void SConvertOp::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); } SConvertOp SConvertOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SConvertOp SConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SConvertOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SConvertOp SConvertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SConvertOp SConvertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SConvertOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps14(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult SConvertOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult SConvertOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SConvertOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void SConvertOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SConvertOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SDivOp definitions //===----------------------------------------------------------------------===// namespace detail { SDivOpGenericAdaptorBase::SDivOpGenericAdaptorBase(SDivOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SDivOpAdaptor::SDivOpAdaptor(SDivOp op) : SDivOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SDivOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SDivOp::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 SDivOp::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 SDivOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SDivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SDivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SDivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SDivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SDivOp::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); } SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SDivOp SDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void SDivOp::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); } SDivOp SDivOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SDivOp::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(SDivOp::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)."); } } SDivOp SDivOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SDivOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SDivOp SDivOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDivOp SDivOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SDivOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SDivOp::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)."); } } SDivOp SDivOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDivOp SDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SDivOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps14(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SDivOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SDivOp::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 SDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 SDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SDivOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SDotAccSatOp definitions //===----------------------------------------------------------------------===// namespace detail { SDotAccSatOpGenericAdaptorBase::SDotAccSatOpGenericAdaptorBase(SDotAccSatOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::PackedVectorFormat> SDotAccSatOpGenericAdaptorBase::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } } // namespace detail SDotAccSatOpAdaptor::SDotAccSatOpAdaptor(SDotAccSatOp op) : SDotAccSatOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SDotAccSatOpAdaptor::verify(::mlir::Location loc) { auto tblgen_format = getProperties().format; (void)tblgen_format; if (tblgen_format && !((::llvm::isa<::mlir::spirv::PackedVectorFormatAttr>(tblgen_format)))) return emitError(loc, "'spirv.SDotAccSat' op attribute 'format' failed to satisfy constraint: valid SPIR-V PackedVectorFormat"); return ::mlir::success(); } ::llvm::LogicalResult SDotAccSatOp::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.format; auto attr = dict.get("format"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `format` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute SDotAccSatOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.format; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("format", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code SDotAccSatOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.format.getAsOpaquePointer())); } std::optional SDotAccSatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "format") return prop.format; return std::nullopt; } void SDotAccSatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "format") { prop.format = ::llvm::dyn_cast_or_null>(value); return; } } void SDotAccSatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.format) attrs.append("format", prop.format); } ::llvm::LogicalResult SDotAccSatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getFormatAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(attr, "format", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SDotAccSatOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.format))) return ::mlir::failure(); return ::mlir::success(); } void SDotAccSatOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.format); } ::std::optional<::mlir::spirv::PackedVectorFormat> SDotAccSatOp::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } void SDotAccSatOp::setFormat(::std::optional<::mlir::spirv::PackedVectorFormat> attrValue) { auto &odsProp = getProperties().format; if (attrValue) odsProp = ::mlir::spirv::PackedVectorFormatAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void SDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } odsState.addTypes(result); } SDotAccSatOp SDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotAccSatOp SDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void SDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SDotAccSatOp::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); } SDotAccSatOp SDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotAccSatOp SDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void SDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SDotAccSatOp SDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotAccSatOp SDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void SDotAccSatOp::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(); ::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."); } } SDotAccSatOp SDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotAccSatOp SDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SDotAccSatOp::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(); ::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(SDotAccSatOp::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)."); } } SDotAccSatOp SDotAccSatOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotAccSatOp SDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SDotAccSatOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SDotAccSatOp SDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotAccSatOp SDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SDotAccSatOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SDotAccSatOp::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)."); } } SDotAccSatOp SDotAccSatOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotAccSatOp SDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SDotAccSatOp::verifyInvariantsImpl() { auto tblgen_format = getProperties().format; (void)tblgen_format; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(*this, tblgen_format, "format"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*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->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that all of {vector1, vector2} have same type"); 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 {accumulator, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SDotAccSatOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult SDotAccSatOp::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 SDotAccSatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vector1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector1Operands(&vector1RawOperand, 1); ::llvm::SMLoc vector1OperandsLoc; (void)vector1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand vector2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector2Operands(&vector2RawOperand, 1); ::llvm::SMLoc vector2OperandsLoc; (void)vector2OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand accumulatorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accumulatorOperands(&accumulatorRawOperand, 1); ::llvm::SMLoc accumulatorOperandsLoc; (void)accumulatorOperandsLoc; ::mlir::spirv::PackedVectorFormatAttr formatAttr; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); vector1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); vector2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector2RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); accumulatorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(accumulatorRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(formatAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (formatAttr) result.getOrAddProperties().format = formatAttr; } { 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(); vector1RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(vector1Operands, vector1Types, vector1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(vector2Operands, vector1Types[0], vector2OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(accumulatorOperands, resultTypes[0], accumulatorOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SDotAccSatOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getVector2(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getAccumulator(); if (getFormatAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getFormatAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("format"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void SDotAccSatOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SDotAccSatOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::SDotAccSatOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SDotOp definitions //===----------------------------------------------------------------------===// namespace detail { SDotOpGenericAdaptorBase::SDotOpGenericAdaptorBase(SDotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::PackedVectorFormat> SDotOpGenericAdaptorBase::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } } // namespace detail SDotOpAdaptor::SDotOpAdaptor(SDotOp op) : SDotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SDotOpAdaptor::verify(::mlir::Location loc) { auto tblgen_format = getProperties().format; (void)tblgen_format; if (tblgen_format && !((::llvm::isa<::mlir::spirv::PackedVectorFormatAttr>(tblgen_format)))) return emitError(loc, "'spirv.SDot' op attribute 'format' failed to satisfy constraint: valid SPIR-V PackedVectorFormat"); return ::mlir::success(); } ::llvm::LogicalResult SDotOp::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.format; auto attr = dict.get("format"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `format` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute SDotOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.format; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("format", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code SDotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.format.getAsOpaquePointer())); } std::optional SDotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "format") return prop.format; return std::nullopt; } void SDotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "format") { prop.format = ::llvm::dyn_cast_or_null>(value); return; } } void SDotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.format) attrs.append("format", prop.format); } ::llvm::LogicalResult SDotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getFormatAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(attr, "format", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SDotOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.format))) return ::mlir::failure(); return ::mlir::success(); } void SDotOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.format); } ::std::optional<::mlir::spirv::PackedVectorFormat> SDotOp::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } void SDotOp::setFormat(::std::optional<::mlir::spirv::PackedVectorFormat> attrValue) { auto &odsProp = getProperties().format; if (attrValue) odsProp = ::mlir::spirv::PackedVectorFormatAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void SDotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); if (format) { odsState.getOrAddProperties().format = format; } odsState.addTypes(result); } SDotOp SDotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotOp SDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(format)); } void SDotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); if (format) { odsState.getOrAddProperties().format = format; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SDotOp SDotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotOp SDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(format)); } void SDotOp::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(); ::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."); } } SDotOp SDotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotOp SDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SDotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SDotOp SDotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SDotOp SDotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SDotOp::verifyInvariantsImpl() { auto tblgen_format = getProperties().format; (void)tblgen_format; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(*this, tblgen_format, "format"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that all of {vector1, vector2} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SDotOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult SDotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vector1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector1Operands(&vector1RawOperand, 1); ::llvm::SMLoc vector1OperandsLoc; (void)vector1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand vector2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector2Operands(&vector2RawOperand, 1); ::llvm::SMLoc vector2OperandsLoc; (void)vector2OperandsLoc; ::mlir::spirv::PackedVectorFormatAttr formatAttr; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); vector1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); vector2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector2RawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(formatAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (formatAttr) result.getOrAddProperties().format = formatAttr; } { 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(); vector1RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(vector1Operands, vector1Types, vector1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(vector2Operands, vector1Types[0], vector2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SDotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getVector2(); if (getFormatAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getFormatAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("format"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void SDotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SDotOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::SDotOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SGreaterThanEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { SGreaterThanEqualOpGenericAdaptorBase::SGreaterThanEqualOpGenericAdaptorBase(SGreaterThanEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SGreaterThanEqualOpAdaptor::SGreaterThanEqualOpAdaptor(SGreaterThanEqualOp op) : SGreaterThanEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SGreaterThanEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SGreaterThanEqualOp::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 SGreaterThanEqualOp::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 SGreaterThanEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SGreaterThanEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SGreaterThanEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SGreaterThanEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SGreaterThanEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void SGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SGreaterThanEqualOp::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); } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void SGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void SGreaterThanEqualOp::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); } SGreaterThanEqualOp SGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SGreaterThanEqualOp::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(SGreaterThanEqualOp::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)."); } } SGreaterThanEqualOp SGreaterThanEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SGreaterThanEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SGreaterThanEqualOp SGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanEqualOp SGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SGreaterThanEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SGreaterThanEqualOp::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)."); } } SGreaterThanEqualOp SGreaterThanEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanEqualOp SGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SGreaterThanEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult SGreaterThanEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SGreaterThanEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult SGreaterThanEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SGreaterThanEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void SGreaterThanEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SGreaterThanEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SGreaterThanOp definitions //===----------------------------------------------------------------------===// namespace detail { SGreaterThanOpGenericAdaptorBase::SGreaterThanOpGenericAdaptorBase(SGreaterThanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SGreaterThanOpAdaptor::SGreaterThanOpAdaptor(SGreaterThanOp op) : SGreaterThanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SGreaterThanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SGreaterThanOp::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 SGreaterThanOp::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 SGreaterThanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SGreaterThanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SGreaterThanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SGreaterThanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SGreaterThanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } SGreaterThanOp SGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanOp SGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void SGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SGreaterThanOp::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); } SGreaterThanOp SGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanOp SGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void SGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SGreaterThanOp SGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanOp SGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void SGreaterThanOp::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); } SGreaterThanOp SGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanOp SGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SGreaterThanOp::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(SGreaterThanOp::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)."); } } SGreaterThanOp SGreaterThanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanOp SGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SGreaterThanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SGreaterThanOp SGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanOp SGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SGreaterThanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SGreaterThanOp::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)."); } } SGreaterThanOp SGreaterThanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SGreaterThanOp SGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SGreaterThanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult SGreaterThanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SGreaterThanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult SGreaterThanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SGreaterThanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void SGreaterThanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SGreaterThanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SLessThanEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { SLessThanEqualOpGenericAdaptorBase::SLessThanEqualOpGenericAdaptorBase(SLessThanEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SLessThanEqualOpAdaptor::SLessThanEqualOpAdaptor(SLessThanEqualOp op) : SLessThanEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SLessThanEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SLessThanEqualOp::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 SLessThanEqualOp::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 SLessThanEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SLessThanEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SLessThanEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SLessThanEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SLessThanEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } SLessThanEqualOp SLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanEqualOp SLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void SLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SLessThanEqualOp::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); } SLessThanEqualOp SLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanEqualOp SLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void SLessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SLessThanEqualOp SLessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanEqualOp SLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void SLessThanEqualOp::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); } SLessThanEqualOp SLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanEqualOp SLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SLessThanEqualOp::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(SLessThanEqualOp::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)."); } } SLessThanEqualOp SLessThanEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanEqualOp SLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SLessThanEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SLessThanEqualOp SLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanEqualOp SLessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SLessThanEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SLessThanEqualOp::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)."); } } SLessThanEqualOp SLessThanEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanEqualOp SLessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SLessThanEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult SLessThanEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SLessThanEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult SLessThanEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SLessThanEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void SLessThanEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SLessThanEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SLessThanOp definitions //===----------------------------------------------------------------------===// namespace detail { SLessThanOpGenericAdaptorBase::SLessThanOpGenericAdaptorBase(SLessThanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SLessThanOpAdaptor::SLessThanOpAdaptor(SLessThanOp op) : SLessThanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SLessThanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SLessThanOp::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 SLessThanOp::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 SLessThanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SLessThanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SLessThanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SLessThanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SLessThanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } SLessThanOp SLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanOp SLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void SLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SLessThanOp::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); } SLessThanOp SLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanOp SLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void SLessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SLessThanOp SLessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanOp SLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void SLessThanOp::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); } SLessThanOp SLessThanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanOp SLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SLessThanOp::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(SLessThanOp::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)."); } } SLessThanOp SLessThanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanOp SLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SLessThanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SLessThanOp SLessThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanOp SLessThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SLessThanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SLessThanOp::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)."); } } SLessThanOp SLessThanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SLessThanOp SLessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SLessThanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult SLessThanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SLessThanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult SLessThanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SLessThanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void SLessThanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SLessThanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SModOp definitions //===----------------------------------------------------------------------===// namespace detail { SModOpGenericAdaptorBase::SModOpGenericAdaptorBase(SModOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SModOpAdaptor::SModOpAdaptor(SModOp op) : SModOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SModOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SModOp::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 SModOp::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 SModOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SModOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SModOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SModOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SModOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } SModOp SModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SModOp SModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void SModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SModOp::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); } SModOp SModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SModOp SModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void SModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SModOp SModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SModOp SModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void SModOp::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); } SModOp SModOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SModOp SModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SModOp::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(SModOp::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)."); } } SModOp SModOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SModOp SModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SModOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SModOp SModOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SModOp SModOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SModOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SModOp::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)."); } } SModOp SModOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SModOp SModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SModOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SModOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SModOp::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 SModOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SModOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 SModOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SModOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SMulExtendedOp definitions //===----------------------------------------------------------------------===// namespace detail { SMulExtendedOpGenericAdaptorBase::SMulExtendedOpGenericAdaptorBase(SMulExtendedOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SMulExtendedOpAdaptor::SMulExtendedOpAdaptor(SMulExtendedOp op) : SMulExtendedOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SMulExtendedOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SMulExtendedOp::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 SMulExtendedOp::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 SMulExtendedOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SMulExtendedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SMulExtendedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SMulExtendedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SMulExtendedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SMulExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value operand1, Value operand2) { build(odsBuilder, odsState, ::mlir::spirv::StructType::get({operand1.getType(), operand1.getType()}), operand1, operand2); } SMulExtendedOp SMulExtendedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value operand1, Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SMulExtendedOp SMulExtendedOp::create(::mlir::ImplicitLocOpBuilder &builder, Value operand1, Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void SMulExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } SMulExtendedOp SMulExtendedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SMulExtendedOp SMulExtendedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void SMulExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SMulExtendedOp SMulExtendedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SMulExtendedOp SMulExtendedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void SMulExtendedOp::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); } SMulExtendedOp SMulExtendedOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SMulExtendedOp SMulExtendedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SMulExtendedOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SMulExtendedOp SMulExtendedOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SMulExtendedOp SMulExtendedOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SMulExtendedOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps25(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult SMulExtendedOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult SMulExtendedOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void SMulExtendedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SMulExtendedOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SNegateOp definitions //===----------------------------------------------------------------------===// namespace detail { SNegateOpGenericAdaptorBase::SNegateOpGenericAdaptorBase(SNegateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SNegateOpAdaptor::SNegateOpAdaptor(SNegateOp op) : SNegateOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SNegateOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SNegateOp::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 SNegateOp::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 SNegateOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SNegateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SNegateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SNegateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SNegateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } SNegateOp SNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SNegateOp SNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void SNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SNegateOp::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); } SNegateOp SNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SNegateOp SNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void SNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SNegateOp SNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SNegateOp SNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void SNegateOp::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); } SNegateOp SNegateOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SNegateOp SNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SNegateOp::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(SNegateOp::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)."); } } SNegateOp SNegateOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SNegateOp SNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SNegateOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SNegateOp SNegateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SNegateOp SNegateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SNegateOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SNegateOp::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)."); } } SNegateOp SNegateOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SNegateOp SNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SNegateOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps14(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {operand, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SNegateOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SNegateOp::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 SNegateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, resultTypes[0], allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SNegateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 SNegateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SNegateOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SRemOp definitions //===----------------------------------------------------------------------===// namespace detail { SRemOpGenericAdaptorBase::SRemOpGenericAdaptorBase(SRemOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SRemOpAdaptor::SRemOpAdaptor(SRemOp op) : SRemOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SRemOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SRemOp::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 SRemOp::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 SRemOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SRemOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SRemOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SRemOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SRemOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SRemOp::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); } SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SRemOp SRemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void SRemOp::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); } SRemOp SRemOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SRemOp::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(SRemOp::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)."); } } SRemOp SRemOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SRemOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SRemOp SRemOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SRemOp SRemOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SRemOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SRemOp::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)."); } } SRemOp SRemOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SRemOp SRemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SRemOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SRemOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SRemOp::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 SRemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SRemOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 SRemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SRemOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SUDotAccSatOp definitions //===----------------------------------------------------------------------===// namespace detail { SUDotAccSatOpGenericAdaptorBase::SUDotAccSatOpGenericAdaptorBase(SUDotAccSatOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::PackedVectorFormat> SUDotAccSatOpGenericAdaptorBase::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } } // namespace detail SUDotAccSatOpAdaptor::SUDotAccSatOpAdaptor(SUDotAccSatOp op) : SUDotAccSatOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SUDotAccSatOpAdaptor::verify(::mlir::Location loc) { auto tblgen_format = getProperties().format; (void)tblgen_format; if (tblgen_format && !((::llvm::isa<::mlir::spirv::PackedVectorFormatAttr>(tblgen_format)))) return emitError(loc, "'spirv.SUDotAccSat' op attribute 'format' failed to satisfy constraint: valid SPIR-V PackedVectorFormat"); return ::mlir::success(); } ::llvm::LogicalResult SUDotAccSatOp::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.format; auto attr = dict.get("format"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `format` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute SUDotAccSatOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.format; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("format", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code SUDotAccSatOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.format.getAsOpaquePointer())); } std::optional SUDotAccSatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "format") return prop.format; return std::nullopt; } void SUDotAccSatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "format") { prop.format = ::llvm::dyn_cast_or_null>(value); return; } } void SUDotAccSatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.format) attrs.append("format", prop.format); } ::llvm::LogicalResult SUDotAccSatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getFormatAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(attr, "format", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SUDotAccSatOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.format))) return ::mlir::failure(); return ::mlir::success(); } void SUDotAccSatOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.format); } ::std::optional<::mlir::spirv::PackedVectorFormat> SUDotAccSatOp::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } void SUDotAccSatOp::setFormat(::std::optional<::mlir::spirv::PackedVectorFormat> attrValue) { auto &odsProp = getProperties().format; if (attrValue) odsProp = ::mlir::spirv::PackedVectorFormatAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void SUDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } odsState.addTypes(result); } SUDotAccSatOp SUDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotAccSatOp SUDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void SUDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SUDotAccSatOp::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); } SUDotAccSatOp SUDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotAccSatOp SUDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void SUDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SUDotAccSatOp SUDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotAccSatOp SUDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void SUDotAccSatOp::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(); ::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."); } } SUDotAccSatOp SUDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotAccSatOp SUDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SUDotAccSatOp::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(); ::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(SUDotAccSatOp::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)."); } } SUDotAccSatOp SUDotAccSatOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotAccSatOp SUDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SUDotAccSatOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SUDotAccSatOp SUDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotAccSatOp SUDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SUDotAccSatOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SUDotAccSatOp::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)."); } } SUDotAccSatOp SUDotAccSatOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotAccSatOp SUDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SUDotAccSatOp::verifyInvariantsImpl() { auto tblgen_format = getProperties().format; (void)tblgen_format; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(*this, tblgen_format, "format"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*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->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that all of {vector1, vector2} have same type"); 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 {accumulator, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SUDotAccSatOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult SUDotAccSatOp::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 SUDotAccSatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vector1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector1Operands(&vector1RawOperand, 1); ::llvm::SMLoc vector1OperandsLoc; (void)vector1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand vector2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector2Operands(&vector2RawOperand, 1); ::llvm::SMLoc vector2OperandsLoc; (void)vector2OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand accumulatorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accumulatorOperands(&accumulatorRawOperand, 1); ::llvm::SMLoc accumulatorOperandsLoc; (void)accumulatorOperandsLoc; ::mlir::spirv::PackedVectorFormatAttr formatAttr; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); vector1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); vector2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector2RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); accumulatorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(accumulatorRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(formatAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (formatAttr) result.getOrAddProperties().format = formatAttr; } { 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(); vector1RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(vector1Operands, vector1Types, vector1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(vector2Operands, vector1Types[0], vector2OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(accumulatorOperands, resultTypes[0], accumulatorOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SUDotAccSatOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getVector2(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getAccumulator(); if (getFormatAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getFormatAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("format"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void SUDotAccSatOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SUDotAccSatOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::SUDotAccSatOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SUDotOp definitions //===----------------------------------------------------------------------===// namespace detail { SUDotOpGenericAdaptorBase::SUDotOpGenericAdaptorBase(SUDotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::PackedVectorFormat> SUDotOpGenericAdaptorBase::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } } // namespace detail SUDotOpAdaptor::SUDotOpAdaptor(SUDotOp op) : SUDotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SUDotOpAdaptor::verify(::mlir::Location loc) { auto tblgen_format = getProperties().format; (void)tblgen_format; if (tblgen_format && !((::llvm::isa<::mlir::spirv::PackedVectorFormatAttr>(tblgen_format)))) return emitError(loc, "'spirv.SUDot' op attribute 'format' failed to satisfy constraint: valid SPIR-V PackedVectorFormat"); return ::mlir::success(); } ::llvm::LogicalResult SUDotOp::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.format; auto attr = dict.get("format"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `format` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute SUDotOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.format; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("format", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code SUDotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.format.getAsOpaquePointer())); } std::optional SUDotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "format") return prop.format; return std::nullopt; } void SUDotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "format") { prop.format = ::llvm::dyn_cast_or_null>(value); return; } } void SUDotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.format) attrs.append("format", prop.format); } ::llvm::LogicalResult SUDotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getFormatAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(attr, "format", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SUDotOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.format))) return ::mlir::failure(); return ::mlir::success(); } void SUDotOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.format); } ::std::optional<::mlir::spirv::PackedVectorFormat> SUDotOp::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } void SUDotOp::setFormat(::std::optional<::mlir::spirv::PackedVectorFormat> attrValue) { auto &odsProp = getProperties().format; if (attrValue) odsProp = ::mlir::spirv::PackedVectorFormatAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void SUDotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); if (format) { odsState.getOrAddProperties().format = format; } odsState.addTypes(result); } SUDotOp SUDotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotOp SUDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(format)); } void SUDotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); if (format) { odsState.getOrAddProperties().format = format; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SUDotOp SUDotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotOp SUDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(format)); } void SUDotOp::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(); ::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."); } } SUDotOp SUDotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotOp SUDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SUDotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SUDotOp SUDotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SUDotOp SUDotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SUDotOp::verifyInvariantsImpl() { auto tblgen_format = getProperties().format; (void)tblgen_format; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(*this, tblgen_format, "format"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that all of {vector1, vector2} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SUDotOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult SUDotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vector1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector1Operands(&vector1RawOperand, 1); ::llvm::SMLoc vector1OperandsLoc; (void)vector1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand vector2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector2Operands(&vector2RawOperand, 1); ::llvm::SMLoc vector2OperandsLoc; (void)vector2OperandsLoc; ::mlir::spirv::PackedVectorFormatAttr formatAttr; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); vector1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); vector2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector2RawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(formatAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (formatAttr) result.getOrAddProperties().format = formatAttr; } { 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(); vector1RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(vector1Operands, vector1Types, vector1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(vector2Operands, vector1Types[0], vector2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SUDotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getVector2(); if (getFormatAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getFormatAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("format"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void SUDotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SUDotOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::SUDotOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SampledImageOp definitions //===----------------------------------------------------------------------===// namespace detail { SampledImageOpGenericAdaptorBase::SampledImageOpGenericAdaptorBase(SampledImageOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SampledImageOpAdaptor::SampledImageOpAdaptor(SampledImageOp op) : SampledImageOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SampledImageOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SampledImageOp::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 SampledImageOp::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 SampledImageOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SampledImageOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SampledImageOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SampledImageOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SampledImageOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SampledImageOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value image, ::mlir::Value sampler) { odsState.addOperands(image); odsState.addOperands(sampler); odsState.addTypes(result); } SampledImageOp SampledImageOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value image, ::mlir::Value sampler) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(image), std::forward(sampler)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SampledImageOp SampledImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value image, ::mlir::Value sampler) { return create(builder, builder.getLoc(), std::forward(result), std::forward(image), std::forward(sampler)); } void SampledImageOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value sampler) { odsState.addOperands(image); odsState.addOperands(sampler); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SampledImageOp SampledImageOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value sampler) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(image), std::forward(sampler)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SampledImageOp SampledImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value image, ::mlir::Value sampler) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(image), std::forward(sampler)); } void SampledImageOp::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); } SampledImageOp SampledImageOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SampledImageOp SampledImageOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SampledImageOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SampledImageOp SampledImageOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SampledImageOp SampledImageOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SampledImageOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps42(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps53(*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_SPIRVOps39(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(::llvm::cast((*this->getODSResults(0).begin()).getType()).getImageType(), (*this->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that type of 'result' wraps the image type of 'image'"); if (!(!((::llvm::is_contained({::mlir::spirv::Dim::SubpassData},::llvm::cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getDim()))))) return emitOpError("failed to verify that the Dim operand of the underlying image must not be SubpassData"); if (!((::llvm::is_contained({::mlir::spirv::ImageSamplerUseInfo::SamplerUnknown, ::mlir::spirv::ImageSamplerUseInfo::NeedSampler},::llvm::cast<::mlir::spirv::ImageType>((*this->getODSOperands(0).begin()).getType()).getSamplerUseInfo())))) return emitOpError("failed to verify that the sampled operand of the underlying image must be SamplerUnknown or NeedSampler"); return ::mlir::success(); } ::llvm::LogicalResult SampledImageOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult SampledImageOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand imageRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> imageOperands(&imageRawOperand, 1); ::llvm::SMLoc imageOperandsLoc; (void)imageOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand samplerRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> samplerOperands(&samplerRawOperand, 1); ::llvm::SMLoc samplerOperandsLoc; (void)samplerOperandsLoc; ::mlir::Type imageRawType{}; ::llvm::ArrayRef<::mlir::Type> imageTypes(&imageRawType, 1); ::mlir::Type samplerRawType{}; ::llvm::ArrayRef<::mlir::Type> samplerTypes(&samplerRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); imageOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(imageRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); samplerOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(samplerRawOperand)) 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(); imageRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); samplerRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(imageOperands, imageTypes, imageOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(samplerOperands, samplerTypes, samplerOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SampledImageOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getImage(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getSampler(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getImage().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getSampler().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 SampledImageOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SampledImageOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SelectOp definitions //===----------------------------------------------------------------------===// namespace detail { SelectOpGenericAdaptorBase::SelectOpGenericAdaptorBase(SelectOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SelectOpAdaptor::SelectOpAdaptor(SelectOp op) : SelectOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SelectOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SelectOp::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 SelectOp::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 SelectOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SelectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SelectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SelectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SelectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { odsState.addOperands(condition); odsState.addOperands(true_value); odsState.addOperands(false_value); odsState.addTypes(result); } SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(condition), std::forward(true_value), std::forward(false_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { return create(builder, builder.getLoc(), std::forward(result), std::forward(condition), std::forward(true_value), std::forward(false_value)); } void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { odsState.addOperands(condition); odsState.addOperands(true_value); odsState.addOperands(false_value); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SelectOp::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); } SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(condition), std::forward(true_value), std::forward(false_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { return create(builder, builder.getLoc(), std::forward(condition), std::forward(true_value), std::forward(false_value)); } void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { odsState.addOperands(condition); odsState.addOperands(true_value); odsState.addOperands(false_value); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SelectOp SelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(condition), std::forward(true_value), std::forward(false_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(condition), std::forward(true_value), std::forward(false_value)); } void SelectOp::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); } SelectOp SelectOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SelectOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SelectOp::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)."); } } SelectOp SelectOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void SelectOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SelectOp SelectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectOp SelectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void SelectOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(SelectOp::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)."); } } SelectOp SelectOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectOp SelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SelectOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps22(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps54(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps54(*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_SPIRVOps54(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that all of {true_value, false_value, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult SelectOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult SelectOp::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 SelectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type conditionRawType{}; ::llvm::ArrayRef<::mlir::Type> conditionTypes(&conditionRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); conditionRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(conditionTypes), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SelectOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getCondition().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 SelectOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SelectOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SelectionOp definitions //===----------------------------------------------------------------------===// namespace detail { SelectionOpGenericAdaptorBase::SelectionOpGenericAdaptorBase(SelectionOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::SelectionControl SelectionOpGenericAdaptorBase::getSelectionControl() { auto attr = getSelectionControlAttr(); return attr.getValue(); } } // namespace detail SelectionOpAdaptor::SelectionOpAdaptor(SelectionOp op) : SelectionOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SelectionOpAdaptor::verify(::mlir::Location loc) { auto tblgen_selection_control = getProperties().selection_control; (void)tblgen_selection_control; if (!tblgen_selection_control) return emitError(loc, "'spirv.mlir.selection' op requires attribute 'selection_control'"); if (tblgen_selection_control && !((::llvm::isa<::mlir::spirv::SelectionControlAttr>(tblgen_selection_control)))) return emitError(loc, "'spirv.mlir.selection' op attribute 'selection_control' failed to satisfy constraint: valid SPIR-V SelectionControl"); return ::mlir::success(); } std::pair SelectionOp::getODSResultIndexAndLength(unsigned index) { bool isVariadic[] = {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()->getNumResults() - 0) / 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}; } ::llvm::LogicalResult SelectionOp::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.selection_control; auto attr = dict.get("selection_control"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `selection_control` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute SelectionOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.selection_control; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("selection_control", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code SelectionOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.selection_control.getAsOpaquePointer())); } std::optional SelectionOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "selection_control") return prop.selection_control; return std::nullopt; } void SelectionOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "selection_control") { prop.selection_control = ::llvm::dyn_cast_or_null>(value); return; } } void SelectionOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.selection_control) attrs.append("selection_control", prop.selection_control); } ::llvm::LogicalResult SelectionOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getSelectionControlAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps32(attr, "selection_control", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SelectionOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.selection_control))) return ::mlir::failure(); return ::mlir::success(); } void SelectionOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.selection_control); } ::mlir::spirv::SelectionControl SelectionOp::getSelectionControl() { auto attr = getSelectionControlAttr(); return attr.getValue(); } void SelectionOp::setSelectionControl(::mlir::spirv::SelectionControl attrValue) { getProperties().selection_control = ::mlir::spirv::SelectionControlAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void SelectionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, spirv::SelectionControl selectionControl) { build(odsBuilder, odsState, TypeRange(), selectionControl); } SelectionOp SelectionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, spirv::SelectionControl selectionControl) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(selectionControl)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectionOp SelectionOp::create(::mlir::ImplicitLocOpBuilder &builder, spirv::SelectionControl selectionControl) { return create(builder, builder.getLoc(), std::forward(selectionControl)); } void SelectionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::spirv::SelectionControlAttr selection_control) { odsState.getOrAddProperties().selection_control = selection_control; (void)odsState.addRegion(); odsState.addTypes(results); } SelectionOp SelectionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::spirv::SelectionControlAttr selection_control) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(results), std::forward(selection_control)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectionOp SelectionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::spirv::SelectionControlAttr selection_control) { return create(builder, builder.getLoc(), std::forward(results), std::forward(selection_control)); } void SelectionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::spirv::SelectionControl selection_control) { odsState.getOrAddProperties().selection_control = ::mlir::spirv::SelectionControlAttr::get(odsBuilder.getContext(), selection_control); (void)odsState.addRegion(); odsState.addTypes(results); } SelectionOp SelectionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::spirv::SelectionControl selection_control) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(results), std::forward(selection_control)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectionOp SelectionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::spirv::SelectionControl selection_control) { return create(builder, builder.getLoc(), std::forward(results), std::forward(selection_control)); } void SelectionOp::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); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } SelectionOp SelectionOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectionOp SelectionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SelectionOp::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)); odsState.addAttributes(discardableAttributes); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); odsState.addTypes(resultTypes); } SelectionOp SelectionOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SelectionOp SelectionOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SelectionOp::verifyInvariantsImpl() { auto tblgen_selection_control = getProperties().selection_control; (void)tblgen_selection_control; if (!tblgen_selection_control) return emitOpError("requires attribute 'selection_control'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps32(*this, tblgen_selection_control, "selection_control"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps19(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); { unsigned index = 0; (void)index; for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) if (::mlir::failed(__mlir_ods_local_region_constraint_SPIRVOps1(*this, region, "body", index++))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SelectionOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SelectionOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.selection_control; auto selection_controlAttrName = ::mlir::StringAttr::get(ctx, "selection_control"); auto attr = dict.get(selection_controlAttrName); usedKeys.insert(selection_controlAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for selection_control in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `selection_control` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SelectionOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::SelectionOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ShiftLeftLogicalOp definitions //===----------------------------------------------------------------------===// namespace detail { ShiftLeftLogicalOpGenericAdaptorBase::ShiftLeftLogicalOpGenericAdaptorBase(ShiftLeftLogicalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ShiftLeftLogicalOpAdaptor::ShiftLeftLogicalOpAdaptor(ShiftLeftLogicalOp op) : ShiftLeftLogicalOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ShiftLeftLogicalOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ShiftLeftLogicalOp::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 ShiftLeftLogicalOp::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 ShiftLeftLogicalOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ShiftLeftLogicalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ShiftLeftLogicalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ShiftLeftLogicalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ShiftLeftLogicalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ShiftLeftLogicalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void ShiftLeftLogicalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ShiftLeftLogicalOp::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); } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void ShiftLeftLogicalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void ShiftLeftLogicalOp::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); } ShiftLeftLogicalOp ShiftLeftLogicalOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ShiftLeftLogicalOp::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(ShiftLeftLogicalOp::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)."); } } ShiftLeftLogicalOp ShiftLeftLogicalOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void ShiftLeftLogicalOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ShiftLeftLogicalOp ShiftLeftLogicalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftLeftLogicalOp ShiftLeftLogicalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void ShiftLeftLogicalOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ShiftLeftLogicalOp::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)."); } } ShiftLeftLogicalOp ShiftLeftLogicalOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftLeftLogicalOp ShiftLeftLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ShiftLeftLogicalOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {operand1, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult ShiftLeftLogicalOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult ShiftLeftLogicalOp::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 ShiftLeftLogicalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); ::mlir::Type operand2RawType{}; ::llvm::ArrayRef<::mlir::Type> operand2Types(&operand2RawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); operand1RawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand2RawType = type; } result.addTypes(operand1Types[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(operand1Types), ::llvm::ArrayRef<::mlir::Type>(operand2Types)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ShiftLeftLogicalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getOperand2().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ShiftLeftLogicalOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ShiftLeftLogicalOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ShiftRightArithmeticOp definitions //===----------------------------------------------------------------------===// namespace detail { ShiftRightArithmeticOpGenericAdaptorBase::ShiftRightArithmeticOpGenericAdaptorBase(ShiftRightArithmeticOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ShiftRightArithmeticOpAdaptor::ShiftRightArithmeticOpAdaptor(ShiftRightArithmeticOp op) : ShiftRightArithmeticOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ShiftRightArithmeticOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ShiftRightArithmeticOp::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 ShiftRightArithmeticOp::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 ShiftRightArithmeticOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ShiftRightArithmeticOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ShiftRightArithmeticOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ShiftRightArithmeticOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ShiftRightArithmeticOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ShiftRightArithmeticOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void ShiftRightArithmeticOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ShiftRightArithmeticOp::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); } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void ShiftRightArithmeticOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void ShiftRightArithmeticOp::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); } ShiftRightArithmeticOp ShiftRightArithmeticOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ShiftRightArithmeticOp::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(ShiftRightArithmeticOp::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)."); } } ShiftRightArithmeticOp ShiftRightArithmeticOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void ShiftRightArithmeticOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ShiftRightArithmeticOp ShiftRightArithmeticOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightArithmeticOp ShiftRightArithmeticOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void ShiftRightArithmeticOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ShiftRightArithmeticOp::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)."); } } ShiftRightArithmeticOp ShiftRightArithmeticOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightArithmeticOp ShiftRightArithmeticOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ShiftRightArithmeticOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {operand1, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult ShiftRightArithmeticOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult ShiftRightArithmeticOp::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 ShiftRightArithmeticOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); ::mlir::Type operand2RawType{}; ::llvm::ArrayRef<::mlir::Type> operand2Types(&operand2RawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); operand1RawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand2RawType = type; } result.addTypes(operand1Types[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(operand1Types), ::llvm::ArrayRef<::mlir::Type>(operand2Types)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ShiftRightArithmeticOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getOperand2().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ShiftRightArithmeticOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ShiftRightArithmeticOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ShiftRightLogicalOp definitions //===----------------------------------------------------------------------===// namespace detail { ShiftRightLogicalOpGenericAdaptorBase::ShiftRightLogicalOpGenericAdaptorBase(ShiftRightLogicalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ShiftRightLogicalOpAdaptor::ShiftRightLogicalOpAdaptor(ShiftRightLogicalOp op) : ShiftRightLogicalOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ShiftRightLogicalOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ShiftRightLogicalOp::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 ShiftRightLogicalOp::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 ShiftRightLogicalOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ShiftRightLogicalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ShiftRightLogicalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ShiftRightLogicalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ShiftRightLogicalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ShiftRightLogicalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void ShiftRightLogicalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ShiftRightLogicalOp::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); } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void ShiftRightLogicalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void ShiftRightLogicalOp::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); } ShiftRightLogicalOp ShiftRightLogicalOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ShiftRightLogicalOp::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(ShiftRightLogicalOp::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)."); } } ShiftRightLogicalOp ShiftRightLogicalOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void ShiftRightLogicalOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ShiftRightLogicalOp ShiftRightLogicalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightLogicalOp ShiftRightLogicalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void ShiftRightLogicalOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ShiftRightLogicalOp::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)."); } } ShiftRightLogicalOp ShiftRightLogicalOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ShiftRightLogicalOp ShiftRightLogicalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ShiftRightLogicalOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {operand1, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult ShiftRightLogicalOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult ShiftRightLogicalOp::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 ShiftRightLogicalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); ::mlir::Type operand2RawType{}; ::llvm::ArrayRef<::mlir::Type> operand2Types(&operand2RawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); operand1RawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand2RawType = type; } result.addTypes(operand1Types[0]); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(operand1Types), ::llvm::ArrayRef<::mlir::Type>(operand2Types)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ShiftRightLogicalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getOperand2().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void ShiftRightLogicalOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ShiftRightLogicalOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SpecConstantCompositeOp definitions //===----------------------------------------------------------------------===// namespace detail { SpecConstantCompositeOpGenericAdaptorBase::SpecConstantCompositeOpGenericAdaptorBase(SpecConstantCompositeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::Type SpecConstantCompositeOpGenericAdaptorBase::getType() { auto attr = getTypeAttr(); return ::llvm::cast<::mlir::Type>(attr.getValue()); } ::llvm::StringRef SpecConstantCompositeOpGenericAdaptorBase::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::mlir::ArrayAttr SpecConstantCompositeOpGenericAdaptorBase::getConstituents() { auto attr = getConstituentsAttr(); return attr; } } // namespace detail SpecConstantCompositeOpAdaptor::SpecConstantCompositeOpAdaptor(SpecConstantCompositeOp op) : SpecConstantCompositeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SpecConstantCompositeOpAdaptor::verify(::mlir::Location loc) { auto tblgen_constituents = getProperties().constituents; (void)tblgen_constituents; if (!tblgen_constituents) return emitError(loc, "'spirv.SpecConstantComposite' op requires attribute 'constituents'"); auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitError(loc, "'spirv.SpecConstantComposite' op requires attribute 'sym_name'"); auto tblgen_type = getProperties().type; (void)tblgen_type; if (!tblgen_type) return emitError(loc, "'spirv.SpecConstantComposite' op requires attribute 'type'"); if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) return emitError(loc, "'spirv.SpecConstantComposite' op attribute 'type' failed to satisfy constraint: any type attribute"); if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) return emitError(loc, "'spirv.SpecConstantComposite' op attribute 'sym_name' failed to satisfy constraint: string attribute"); if (tblgen_constituents && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_constituents))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_constituents), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) return emitError(loc, "'spirv.SpecConstantComposite' op attribute 'constituents' failed to satisfy constraint: symbol ref array attribute"); return ::mlir::success(); } ::llvm::LogicalResult SpecConstantCompositeOp::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.constituents; auto attr = dict.get("constituents"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `constituents` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto attr = dict.get("sym_name"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.type; auto attr = dict.get("type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `type` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute SpecConstantCompositeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.constituents; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("constituents", propStorage)); } { const auto &propStorage = prop.sym_name; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("sym_name", propStorage)); } { const auto &propStorage = prop.type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("type", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code SpecConstantCompositeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.constituents.getAsOpaquePointer()), llvm::hash_value(prop.sym_name.getAsOpaquePointer()), llvm::hash_value(prop.type.getAsOpaquePointer())); } std::optional SpecConstantCompositeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "constituents") return prop.constituents; if (name == "sym_name") return prop.sym_name; if (name == "type") return prop.type; return std::nullopt; } void SpecConstantCompositeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "constituents") { prop.constituents = ::llvm::dyn_cast_or_null>(value); return; } if (name == "sym_name") { prop.sym_name = ::llvm::dyn_cast_or_null>(value); return; } if (name == "type") { prop.type = ::llvm::dyn_cast_or_null>(value); return; } } void SpecConstantCompositeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.constituents) attrs.append("constituents", prop.constituents); if (prop.sym_name) attrs.append("sym_name", prop.sym_name); if (prop.type) attrs.append("type", prop.type); } ::llvm::LogicalResult SpecConstantCompositeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getConstituentsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps12(attr, "constituents", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(attr, "sym_name", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps8(attr, "type", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SpecConstantCompositeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.constituents))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.sym_name))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.type))) return ::mlir::failure(); return ::mlir::success(); } void SpecConstantCompositeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.constituents); writer.writeAttribute(prop.sym_name); writer.writeAttribute(prop.type); } ::mlir::Type SpecConstantCompositeOp::getType() { auto attr = getTypeAttr(); return ::llvm::cast<::mlir::Type>(attr.getValue()); } ::llvm::StringRef SpecConstantCompositeOp::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::mlir::ArrayAttr SpecConstantCompositeOp::getConstituents() { auto attr = getConstituentsAttr(); return attr; } void SpecConstantCompositeOp::setType(::mlir::Type attrValue) { getProperties().type = ::mlir::TypeAttr::get(attrValue); } void SpecConstantCompositeOp::setSymName(::llvm::StringRef attrValue) { getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue); } void SpecConstantCompositeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr constituents) { odsState.getOrAddProperties().type = type; odsState.getOrAddProperties().sym_name = sym_name; odsState.getOrAddProperties().constituents = constituents; } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr constituents) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(sym_name), std::forward(constituents)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr constituents) { return create(builder, builder.getLoc(), std::forward(type), std::forward(sym_name), std::forward(constituents)); } void SpecConstantCompositeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr constituents) { odsState.getOrAddProperties().type = type; odsState.getOrAddProperties().sym_name = sym_name; odsState.getOrAddProperties().constituents = constituents; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr constituents) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(constituents)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr type, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr constituents) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(constituents)); } void SpecConstantCompositeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::ArrayAttr constituents) { odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); odsState.getOrAddProperties().constituents = constituents; } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::ArrayAttr constituents) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(type), std::forward(sym_name), std::forward(constituents)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::ArrayAttr constituents) { return create(builder, builder.getLoc(), std::forward(type), std::forward(sym_name), std::forward(constituents)); } void SpecConstantCompositeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::ArrayAttr constituents) { odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); odsState.getOrAddProperties().constituents = constituents; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::ArrayAttr constituents) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(constituents)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Type type, ::llvm::StringRef sym_name, ::mlir::ArrayAttr constituents) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(type), std::forward(sym_name), std::forward(constituents)); } void SpecConstantCompositeOp::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(); ::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."); } } SpecConstantCompositeOp SpecConstantCompositeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantCompositeOp SpecConstantCompositeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SpecConstantCompositeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SpecConstantCompositeOp SpecConstantCompositeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantCompositeOp SpecConstantCompositeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SpecConstantCompositeOp::verifyInvariantsImpl() { auto tblgen_constituents = getProperties().constituents; (void)tblgen_constituents; if (!tblgen_constituents) return emitOpError("requires attribute 'constituents'"); auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); auto tblgen_type = getProperties().type; (void)tblgen_type; if (!tblgen_type) return emitOpError("requires attribute 'type'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps8(*this, tblgen_type, "type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(*this, tblgen_sym_name, "sym_name"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps12(*this, tblgen_constituents, "constituents"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult SpecConstantCompositeOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult SpecConstantCompositeOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.type; auto typeAttrName = ::mlir::StringAttr::get(ctx, "type"); auto attr = dict.get(typeAttrName); usedKeys.insert(typeAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for type in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name"); auto attr = dict.get(sym_nameAttrName); usedKeys.insert(sym_nameAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for sym_name in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.constituents; auto constituentsAttrName = ::mlir::StringAttr::get(ctx, "constituents"); auto attr = dict.get(constituentsAttrName); usedKeys.insert(constituentsAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for constituents in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `constituents` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SpecConstantCompositeOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::SpecConstantCompositeOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SpecConstantOp definitions //===----------------------------------------------------------------------===// namespace detail { SpecConstantOpGenericAdaptorBase::SpecConstantOpGenericAdaptorBase(SpecConstantOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::llvm::StringRef SpecConstantOpGenericAdaptorBase::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::mlir::TypedAttr SpecConstantOpGenericAdaptorBase::getDefaultValue() { auto attr = getDefaultValueAttr(); return attr; } } // namespace detail SpecConstantOpAdaptor::SpecConstantOpAdaptor(SpecConstantOp op) : SpecConstantOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SpecConstantOpAdaptor::verify(::mlir::Location loc) { auto tblgen_default_value = getProperties().default_value; (void)tblgen_default_value; if (!tblgen_default_value) return emitError(loc, "'spirv.SpecConstant' op requires attribute 'default_value'"); auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitError(loc, "'spirv.SpecConstant' op requires attribute 'sym_name'"); if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) return emitError(loc, "'spirv.SpecConstant' op attribute 'sym_name' failed to satisfy constraint: string attribute"); if (tblgen_default_value && !((::llvm::isa<::mlir::TypedAttr>(tblgen_default_value)))) return emitError(loc, "'spirv.SpecConstant' op attribute 'default_value' failed to satisfy constraint: TypedAttr instance"); return ::mlir::success(); } ::llvm::LogicalResult SpecConstantOp::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.default_value; auto attr = dict.get("default_value"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `default_value` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.sym_name; auto attr = dict.get("sym_name"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute SpecConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.default_value; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("default_value", propStorage)); } { const auto &propStorage = prop.sym_name; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("sym_name", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code SpecConstantOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.default_value.getAsOpaquePointer()), llvm::hash_value(prop.sym_name.getAsOpaquePointer())); } std::optional SpecConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "default_value") return prop.default_value; if (name == "sym_name") return prop.sym_name; return std::nullopt; } void SpecConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "default_value") { prop.default_value = ::llvm::dyn_cast_or_null>(value); return; } if (name == "sym_name") { prop.sym_name = ::llvm::dyn_cast_or_null>(value); return; } } void SpecConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.default_value) attrs.append("default_value", prop.default_value); if (prop.sym_name) attrs.append("sym_name", prop.sym_name); } ::llvm::LogicalResult SpecConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getDefaultValueAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps33(attr, "default_value", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(attr, "sym_name", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SpecConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.default_value))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.sym_name))) return ::mlir::failure(); return ::mlir::success(); } void SpecConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.default_value); writer.writeAttribute(prop.sym_name); } ::llvm::StringRef SpecConstantOp::getSymName() { auto attr = getSymNameAttr(); return attr.getValue(); } ::mlir::TypedAttr SpecConstantOp::getDefaultValue() { auto attr = getDefaultValueAttr(); return attr; } void SpecConstantOp::setSymName(::llvm::StringRef attrValue) { getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue); } void SpecConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypedAttr default_value) { odsState.getOrAddProperties().sym_name = sym_name; odsState.getOrAddProperties().default_value = default_value; } SpecConstantOp SpecConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypedAttr default_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(sym_name), std::forward(default_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOp SpecConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypedAttr default_value) { return create(builder, builder.getLoc(), std::forward(sym_name), std::forward(default_value)); } void SpecConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypedAttr default_value) { odsState.getOrAddProperties().sym_name = sym_name; odsState.getOrAddProperties().default_value = default_value; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } SpecConstantOp SpecConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypedAttr default_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(sym_name), std::forward(default_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOp SpecConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypedAttr default_value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(sym_name), std::forward(default_value)); } void SpecConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::TypedAttr default_value) { odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); odsState.getOrAddProperties().default_value = default_value; } SpecConstantOp SpecConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::TypedAttr default_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(sym_name), std::forward(default_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOp SpecConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::TypedAttr default_value) { return create(builder, builder.getLoc(), std::forward(sym_name), std::forward(default_value)); } void SpecConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::TypedAttr default_value) { odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); odsState.getOrAddProperties().default_value = default_value; assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } SpecConstantOp SpecConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::TypedAttr default_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(sym_name), std::forward(default_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOp SpecConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::TypedAttr default_value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(sym_name), std::forward(default_value)); } void SpecConstantOp::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(); ::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."); } } SpecConstantOp SpecConstantOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOp SpecConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SpecConstantOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SpecConstantOp SpecConstantOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOp SpecConstantOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SpecConstantOp::verifyInvariantsImpl() { auto tblgen_default_value = getProperties().default_value; (void)tblgen_default_value; if (!tblgen_default_value) return emitOpError("requires attribute 'default_value'"); auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps9(*this, tblgen_sym_name, "sym_name"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps33(*this, tblgen_default_value, "default_value"))) return ::mlir::failure(); if (!((isDirectInModuleLikeOp((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a module-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult SpecConstantOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult SpecConstantOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.sym_name; auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name"); auto attr = dict.get(sym_nameAttrName); usedKeys.insert(sym_nameAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for sym_name in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.default_value; auto default_valueAttrName = ::mlir::StringAttr::get(ctx, "default_value"); auto attr = dict.get(default_valueAttrName); usedKeys.insert(default_valueAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for default_value in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `default_value` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SpecConstantOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::SpecConstantOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SpecConstantOperationOp definitions //===----------------------------------------------------------------------===// namespace detail { SpecConstantOperationOpGenericAdaptorBase::SpecConstantOperationOpGenericAdaptorBase(SpecConstantOperationOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail SpecConstantOperationOpAdaptor::SpecConstantOperationOpAdaptor(SpecConstantOperationOp op) : SpecConstantOperationOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SpecConstantOperationOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult SpecConstantOperationOp::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 SpecConstantOperationOp::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 SpecConstantOperationOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional SpecConstantOperationOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void SpecConstantOperationOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void SpecConstantOperationOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult SpecConstantOperationOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void SpecConstantOperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { (void)odsState.addRegion(); odsState.addTypes(result); } SpecConstantOperationOp SpecConstantOperationOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOperationOp SpecConstantOperationOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result) { return create(builder, builder.getLoc(), std::forward(result)); } void SpecConstantOperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { (void)odsState.addRegion(); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } SpecConstantOperationOp SpecConstantOperationOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOperationOp SpecConstantOperationOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) { return create(builder, builder.getLoc(), std::forward(resultTypes)); } void SpecConstantOperationOp::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); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SpecConstantOperationOp SpecConstantOperationOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOperationOp SpecConstantOperationOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SpecConstantOperationOp::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)); odsState.addAttributes(discardableAttributes); for (unsigned i = 0; i != 1; ++i) (void)odsState.addRegion(); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SpecConstantOperationOp SpecConstantOperationOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SpecConstantOperationOp SpecConstantOperationOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SpecConstantOperationOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps20(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); { unsigned index = 0; (void)index; for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) if (::mlir::failed(__mlir_ods_local_region_constraint_SPIRVOps2(*this, region, "body", index++))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SpecConstantOperationOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult SpecConstantOperationOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void SpecConstantOperationOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SpecConstantOperationOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::StoreOp definitions //===----------------------------------------------------------------------===// namespace detail { StoreOpGenericAdaptorBase::StoreOpGenericAdaptorBase(StoreOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::MemoryAccess> StoreOpGenericAdaptorBase::getMemoryAccess() { auto attr = getMemoryAccessAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional StoreOpGenericAdaptorBase::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } } // namespace detail StoreOpAdaptor::StoreOpAdaptor(StoreOp op) : StoreOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult StoreOpAdaptor::verify(::mlir::Location loc) { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_memory_access = getProperties().memory_access; (void)tblgen_memory_access; if (tblgen_memory_access && !((::llvm::isa<::mlir::spirv::MemoryAccessAttr>(tblgen_memory_access)))) return emitError(loc, "'spirv.Store' op attribute 'memory_access' failed to satisfy constraint: valid SPIR-V MemoryAccess"); if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32)))) && (((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isStrictlyPositive())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isPowerOf2()))))) return emitError(loc, "'spirv.Store' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0"); return ::mlir::success(); } ::llvm::LogicalResult StoreOp::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.alignment; auto attr = dict.get("alignment"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `alignment` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.memory_access; auto attr = dict.get("memory_access"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_access` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute StoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.alignment; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("alignment", propStorage)); } { const auto &propStorage = prop.memory_access; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("memory_access", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code StoreOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.alignment.getAsOpaquePointer()), llvm::hash_value(prop.memory_access.getAsOpaquePointer())); } std::optional StoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "alignment") return prop.alignment; if (name == "memory_access") return prop.memory_access; return std::nullopt; } void StoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "alignment") { prop.alignment = ::llvm::dyn_cast_or_null>(value); return; } if (name == "memory_access") { prop.memory_access = ::llvm::dyn_cast_or_null>(value); return; } } void StoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.alignment) attrs.append("alignment", prop.alignment); if (prop.memory_access) attrs.append("memory_access", prop.memory_access); } ::llvm::LogicalResult StoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(attr, "alignment", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMemoryAccessAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(attr, "memory_access", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult StoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.memory_access))) return ::mlir::failure(); return ::mlir::success(); } void StoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.alignment); writer.writeOptionalAttribute(prop.memory_access); } ::std::optional<::mlir::spirv::MemoryAccess> StoreOp::getMemoryAccess() { auto attr = getMemoryAccessAttr(); return attr ? ::std::optional<::mlir::spirv::MemoryAccess>(attr.getValue()) : (::std::nullopt); } ::std::optional StoreOp::getAlignment() { auto attr = getAlignmentAttr(); return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); } void StoreOp::setMemoryAccess(::std::optional<::mlir::spirv::MemoryAccess> attrValue) { auto &odsProp = getProperties().memory_access; if (attrValue) odsProp = ::mlir::spirv::MemoryAccessAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void StoreOp::setAlignment(::std::optional attrValue) { auto &odsProp = getProperties().alignment; if (attrValue) odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue); else odsProp = nullptr; } void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value ptr, Value value, ArrayRef namedAttrs) { odsState.addOperands(ptr); odsState.addOperands(value); odsState.addAttributes(namedAttrs); } StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value ptr, Value value, ArrayRef namedAttrs) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(ptr), std::forward(value), std::forward(namedAttrs)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, Value ptr, Value value, ArrayRef namedAttrs) { return create(builder, builder.getLoc(), std::forward(ptr), std::forward(value), std::forward(namedAttrs)); } void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value value, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(ptr); odsState.addOperands(value); if (memory_access) { odsState.getOrAddProperties().memory_access = memory_access; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } } StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value ptr, ::mlir::Value value, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(ptr), std::forward(value), std::forward(memory_access), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value ptr, ::mlir::Value value, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(ptr), std::forward(value), std::forward(memory_access), std::forward(alignment)); } void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value value, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { odsState.addOperands(ptr); odsState.addOperands(value); if (memory_access) { odsState.getOrAddProperties().memory_access = memory_access; } if (alignment) { odsState.getOrAddProperties().alignment = alignment; } assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value value, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(ptr), std::forward(value), std::forward(memory_access), std::forward(alignment)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value value, /*optional*/::mlir::spirv::MemoryAccessAttr memory_access, /*optional*/::mlir::IntegerAttr alignment) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(ptr), std::forward(value), std::forward(memory_access), std::forward(alignment)); } void StoreOp::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(); ::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."); } } StoreOp StoreOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void StoreOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } StoreOp StoreOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } StoreOp StoreOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult StoreOp::verifyInvariantsImpl() { auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; auto tblgen_memory_access = getProperties().memory_access; (void)tblgen_memory_access; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps6(*this, tblgen_memory_access, "memory_access"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps7(*this, tblgen_alignment, "alignment"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps1(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps12(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult StoreOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult StoreOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.memory_access; auto memory_accessAttrName = ::mlir::StringAttr::get(ctx, "memory_access"); auto attr = dict.get(memory_accessAttrName); usedKeys.insert(memory_accessAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for memory_access in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `memory_access` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.alignment; auto alignmentAttrName = ::mlir::StringAttr::get(ctx, "alignment"); auto attr = dict.get(alignmentAttrName); usedKeys.insert(alignmentAttrName); if (attr || /*isRequired=*/false) { if (!attr) { emitError() << "expected key entry for alignment in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `alignment` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::StoreOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::StoreOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::SwitchOp definitions //===----------------------------------------------------------------------===// namespace detail { SwitchOpGenericAdaptorBase::SwitchOpGenericAdaptorBase(SwitchOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair SwitchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; unsigned start = 0; for (unsigned i = 0; i < index; ++i) start += sizeAttr[i]; return {start, sizeAttr[index]}; } ::std::optional< ::mlir::DenseIntElementsAttr > SwitchOpGenericAdaptorBase::getLiterals() { auto attr = getLiteralsAttr(); return attr ? ::std::optional< ::mlir::DenseIntElementsAttr >(attr) : (::std::nullopt); } ::llvm::ArrayRef SwitchOpGenericAdaptorBase::getCaseOperandSegments() { auto attr = getCaseOperandSegmentsAttr(); return attr; } } // namespace detail SwitchOpAdaptor::SwitchOpAdaptor(SwitchOp op) : SwitchOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult SwitchOpAdaptor::verify(::mlir::Location loc) { auto tblgen_case_operand_segments = getProperties().case_operand_segments; (void)tblgen_case_operand_segments; if (!tblgen_case_operand_segments) return emitError(loc, "'spirv.Switch' op requires attribute 'case_operand_segments'"); auto tblgen_literals = getProperties().literals; (void)tblgen_literals; if (tblgen_literals && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_literals))) && ((true)))) return emitError(loc, "'spirv.Switch' op attribute 'literals' failed to satisfy constraint: integer elements attribute"); if (tblgen_case_operand_segments && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_case_operand_segments)))) return emitError(loc, "'spirv.Switch' op attribute 'case_operand_segments' failed to satisfy constraint: i32 dense array attribute"); return ::mlir::success(); } std::pair SwitchOp::getODSOperandIndexAndLength(unsigned index) { ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; unsigned start = 0; for (unsigned i = 0; i < index; ++i) start += sizeAttr[i]; return {start, sizeAttr[index]}; } ::mlir::MutableOperandRange SwitchOp::getDefaultOperandsMutable() { 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::MutableOperandRangeRange SwitchOp::getTargetOperandsMutable() { 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.split(*(*this)->getAttrDictionary().getNamed(getCaseOperandSegmentsAttrName())); } ::llvm::LogicalResult SwitchOp::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.case_operand_segments; auto attr = dict.get("case_operand_segments"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `case_operand_segments` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.literals; auto attr = dict.get("literals"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `literals` 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 SwitchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.case_operand_segments; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("case_operand_segments", propStorage)); } { const auto &propStorage = prop.literals; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("literals", 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 SwitchOp::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.case_operand_segments.getAsOpaquePointer()), llvm::hash_value(prop.literals.getAsOpaquePointer()), hash_operandSegmentSizes_(prop.operandSegmentSizes)); } std::optional SwitchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "case_operand_segments") return prop.case_operand_segments; if (name == "literals") return prop.literals; if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }(); return std::nullopt; } void SwitchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "case_operand_segments") { prop.case_operand_segments = ::llvm::dyn_cast_or_null>(value); return; } if (name == "literals") { prop.literals = ::llvm::dyn_cast_or_null>(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 SwitchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.case_operand_segments) attrs.append("case_operand_segments", prop.case_operand_segments); if (prop.literals) attrs.append("literals", prop.literals); attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }()); } ::llvm::LogicalResult SwitchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getCaseOperandSegmentsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps35(attr, "case_operand_segments", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLiteralsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps34(attr, "literals", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult SwitchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.case_operand_segments))) return ::mlir::failure(); if (::mlir::failed(reader.readOptionalAttribute(prop.literals))) 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(sizeof(propStorage) / sizeof(int32_t))) { reader.emitError("size mismatch for operand/result_segment_size"); return ::mlir::failure(); } ::llvm::copy(::llvm::ArrayRef(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 SwitchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.case_operand_segments); writer.writeOptionalAttribute(prop.literals); 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)); ; } } ::std::optional< ::mlir::DenseIntElementsAttr > SwitchOp::getLiterals() { auto attr = getLiteralsAttr(); return attr ? ::std::optional< ::mlir::DenseIntElementsAttr >(attr) : (::std::nullopt); } ::llvm::ArrayRef SwitchOp::getCaseOperandSegments() { auto attr = getCaseOperandSegmentsAttr(); return attr; } void SwitchOp::setCaseOperandSegments(::llvm::ArrayRef attrValue) { getProperties().case_operand_segments = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue); } SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value selector, Block *defaultTarget, ValueRange defaultOperands, ArrayRef literals, BlockRange targets, ArrayRef targetOperands) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(selector), std::forward(defaultTarget), std::forward(defaultOperands), std::forward(literals), std::forward(targets), std::forward(targetOperands)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, Value selector, Block *defaultTarget, ValueRange defaultOperands, ArrayRef literals, BlockRange targets, ArrayRef targetOperands) { return create(builder, builder.getLoc(), std::forward(selector), std::forward(defaultTarget), std::forward(defaultOperands), std::forward(literals), std::forward(targets), std::forward(targetOperands)); } SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value selector, Block *defaultTarget, ValueRange defaultOperands, ArrayRef literals, BlockRange targets, ArrayRef targetOperands) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(selector), std::forward(defaultTarget), std::forward(defaultOperands), std::forward(literals), std::forward(targets), std::forward(targetOperands)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, Value selector, Block *defaultTarget, ValueRange defaultOperands, ArrayRef literals, BlockRange targets, ArrayRef targetOperands) { return create(builder, builder.getLoc(), std::forward(selector), std::forward(defaultTarget), std::forward(defaultOperands), std::forward(literals), std::forward(targets), std::forward(targetOperands)); } SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value selector, Block *defaultTarget, ValueRange defaultOperands, DenseIntElementsAttr literals, BlockRange targets, ArrayRef targetOperands) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(selector), std::forward(defaultTarget), std::forward(defaultOperands), std::forward(literals), std::forward(targets), std::forward(targetOperands)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, Value selector, Block *defaultTarget, ValueRange defaultOperands, DenseIntElementsAttr literals, BlockRange targets, ArrayRef targetOperands) { return create(builder, builder.getLoc(), std::forward(selector), std::forward(defaultTarget), std::forward(defaultOperands), std::forward(literals), std::forward(targets), std::forward(targetOperands)); } void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value selector, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> targetOperands, /*optional*/::mlir::DenseIntElementsAttr literals, ::mlir::Block *defaultTarget, ::mlir::BlockRange targets) { odsState.addOperands(selector); odsState.addOperands(defaultOperands); for (::mlir::ValueRange range : targetOperands) odsState.addOperands(range); { ::llvm::SmallVector rangeSegments; for (::mlir::ValueRange range : targetOperands) rangeSegments.push_back(range.size()); auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments); odsState.getOrAddProperties().case_operand_segments = rangeAttr; } ::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperands.size()), llvm::accumulate(targetOperands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast(range.size()); })}), odsState.getOrAddProperties().operandSegmentSizes.begin()); if (literals) { odsState.getOrAddProperties().literals = literals; } odsState.addSuccessors(defaultTarget); odsState.addSuccessors(targets); } SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value selector, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> targetOperands, /*optional*/::mlir::DenseIntElementsAttr literals, ::mlir::Block *defaultTarget, ::mlir::BlockRange targets) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(selector), std::forward(defaultOperands), std::forward(targetOperands), std::forward(literals), std::forward(defaultTarget), std::forward(targets)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value selector, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> targetOperands, /*optional*/::mlir::DenseIntElementsAttr literals, ::mlir::Block *defaultTarget, ::mlir::BlockRange targets) { return create(builder, builder.getLoc(), std::forward(selector), std::forward(defaultOperands), std::forward(targetOperands), std::forward(literals), std::forward(defaultTarget), std::forward(targets)); } void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value selector, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> targetOperands, /*optional*/::mlir::DenseIntElementsAttr literals, ::mlir::Block *defaultTarget, ::mlir::BlockRange targets) { odsState.addOperands(selector); odsState.addOperands(defaultOperands); for (::mlir::ValueRange range : targetOperands) odsState.addOperands(range); { ::llvm::SmallVector rangeSegments; for (::mlir::ValueRange range : targetOperands) rangeSegments.push_back(range.size()); auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments); odsState.getOrAddProperties().case_operand_segments = rangeAttr; } ::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperands.size()), llvm::accumulate(targetOperands, int32_t(0), [](int32_t curSum, ::mlir::ValueRange range) { return curSum + static_cast(range.size()); })}), odsState.getOrAddProperties().operandSegmentSizes.begin()); if (literals) { odsState.getOrAddProperties().literals = literals; } odsState.addSuccessors(defaultTarget); odsState.addSuccessors(targets); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value selector, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> targetOperands, /*optional*/::mlir::DenseIntElementsAttr literals, ::mlir::Block *defaultTarget, ::mlir::BlockRange targets) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(selector), std::forward(defaultOperands), std::forward(targetOperands), std::forward(literals), std::forward(defaultTarget), std::forward(targets)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value selector, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> targetOperands, /*optional*/::mlir::DenseIntElementsAttr literals, ::mlir::Block *defaultTarget, ::mlir::BlockRange targets) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(selector), std::forward(defaultOperands), std::forward(targetOperands), std::forward(literals), std::forward(defaultTarget), std::forward(targets)); } void SwitchOp::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(); ::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."); } } SwitchOp SwitchOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void SwitchOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } SwitchOp SwitchOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } SwitchOp SwitchOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult SwitchOp::verifyInvariantsImpl() { auto tblgen_case_operand_segments = getProperties().case_operand_segments; (void)tblgen_case_operand_segments; if (!tblgen_case_operand_segments) return emitOpError("requires attribute 'case_operand_segments'"); auto tblgen_literals = getProperties().literals; (void)tblgen_literals; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps34(*this, tblgen_literals, "literals"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps35(*this, tblgen_case_operand_segments, "case_operand_segments"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps19(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "case_operand_segments", "targetOperands", valueGroup2.size()))) return ::mlir::failure(); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps19(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); { unsigned index = 0; (void)index; } return ::mlir::success(); } ::llvm::LogicalResult SwitchOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult SwitchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand selectorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> selectorOperands(&selectorRawOperand, 1); ::llvm::SMLoc selectorOperandsLoc; (void)selectorOperandsLoc; ::mlir::Type selectorRawType{}; ::llvm::ArrayRef<::mlir::Type> selectorTypes(&selectorRawType, 1); ::mlir::Block *defaultTargetSuccessor = nullptr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> defaultOperandsOperands; ::llvm::SMLoc defaultOperandsOperandsLoc; (void)defaultOperandsOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> defaultOperandsTypes; ::mlir::DenseIntElementsAttr literalsAttr; ::llvm::SmallVector<::mlir::Block *, 2> targetsSuccessors; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> targetOperandsOperands; llvm::SmallVector targetOperandsOperandGroupSizes; ::llvm::SMLoc targetOperandsOperandsLoc; (void)targetOperandsOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> targetOperandsTypes; selectorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(selectorRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); selectorRawType = type; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseLSquare()) return ::mlir::failure(); { defaultOperandsOperandsLoc = parser.getCurrentLocation(); targetOperandsOperandsLoc = parser.getCurrentLocation(); ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> targetOperandsOperandGroups; ::llvm::SmallVector> targetOperandsTypeGroups; auto odsResult = parseSwitchOpCases(parser, selectorRawType, defaultTargetSuccessor, defaultOperandsOperands, defaultOperandsTypes, literalsAttr, targetsSuccessors, targetOperandsOperandGroups, targetOperandsTypeGroups); if (odsResult) return ::mlir::failure(); if (literalsAttr) result.getOrAddProperties().literals = literalsAttr; for (const auto &subRange : targetOperandsOperandGroups) { targetOperandsOperands.append(subRange.begin(), subRange.end()); targetOperandsOperandGroupSizes.push_back(subRange.size()); } for (const auto &subRange : targetOperandsTypeGroups) targetOperandsTypes.append(subRange.begin(), subRange.end()); } 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(); } result.addSuccessors(defaultTargetSuccessor); result.addSuccessors(targetsSuccessors); ::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperandsOperands.size()), static_cast(targetOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); result.getOrAddProperties().case_operand_segments = parser.getBuilder().getDenseI32ArrayAttr(targetOperandsOperandGroupSizes); if (parser.resolveOperands(selectorOperands, selectorTypes, selectorOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(defaultOperandsOperands, defaultOperandsTypes, defaultOperandsOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(targetOperandsOperands, targetOperandsTypes, targetOperandsOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void SwitchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getSelector(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getSelector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' ' << "["; _odsPrinter.printNewline(); printSwitchOpCases(_odsPrinter, *this, getSelector().getType(), getDefaultTarget(), getDefaultOperands(), getDefaultOperands().getTypes(), getLiteralsAttr(), getTargets(), getTargetOperands(), getTargetOperands().getTypes()); _odsPrinter << "]"; ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("operandSegmentSizes"); elidedAttrs.push_back("case_operand_segments"); elidedAttrs.push_back("literals"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void SwitchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::SwitchOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::SwitchOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaAbsOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaAbsOpGenericAdaptorBase::TosaAbsOpGenericAdaptorBase(TosaAbsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaAbsOpAdaptor::TosaAbsOpAdaptor(TosaAbsOp op) : TosaAbsOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaAbsOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaAbsOp::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 TosaAbsOp::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 TosaAbsOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaAbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaAbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaAbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaAbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaAbsOp TosaAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAbsOp TosaAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaAbsOp::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); } TosaAbsOp TosaAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAbsOp TosaAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaAbsOp TosaAbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAbsOp TosaAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaAbsOp::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); } TosaAbsOp TosaAbsOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAbsOp TosaAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaAbsOp::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(TosaAbsOp::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)."); } } TosaAbsOp TosaAbsOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAbsOp TosaAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaAbsOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaAbsOp TosaAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAbsOp TosaAbsOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaAbsOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaAbsOp::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)."); } } TosaAbsOp TosaAbsOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAbsOp TosaAbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaAbsOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps55(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaAbsOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaAbsOp::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 TosaAbsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaAbsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaAbsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaAbsOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaAddOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaAddOpGenericAdaptorBase::TosaAddOpGenericAdaptorBase(TosaAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaAddOpAdaptor::TosaAddOpAdaptor(TosaAddOp op) : TosaAddOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaAddOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaAddOp::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 TosaAddOp::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 TosaAddOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaAddOp TosaAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAddOp TosaAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaAddOp TosaAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAddOp TosaAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaAddOp::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); } TosaAddOp TosaAddOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAddOp TosaAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaAddOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaAddOp TosaAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAddOp TosaAddOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaAddOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps55(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaAddOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaAddOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaArgMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaArgMaxOpGenericAdaptorBase::TosaArgMaxOpGenericAdaptorBase(TosaArgMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t TosaArgMaxOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } ::mlir::spirv::TosaExtNaNPropagationModeType TosaArgMaxOpGenericAdaptorBase::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } } // namespace detail TosaArgMaxOpAdaptor::TosaArgMaxOpAdaptor(TosaArgMaxOp op) : TosaArgMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaArgMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.ArgMax' op requires attribute 'axis'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitError(loc, "'spirv.Tosa.ArgMax' op requires attribute 'nan_mode'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.ArgMax' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); if (tblgen_nan_mode && !((::llvm::isa<::mlir::spirv::TosaExtNaNPropagationModeTypeAttr>(tblgen_nan_mode)))) return emitError(loc, "'spirv.Tosa.ArgMax' op attribute 'nan_mode' failed to satisfy constraint: Tosa Ext NaN Propoagation Mode Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaArgMaxOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.nan_mode; auto attr = dict.get("nan_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `nan_mode` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaArgMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } { const auto &propStorage = prop.nan_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("nan_mode", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaArgMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer()), llvm::hash_value(prop.nan_mode.getAsOpaquePointer())); } std::optional TosaArgMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; if (name == "nan_mode") return prop.nan_mode; return std::nullopt; } void TosaArgMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } if (name == "nan_mode") { prop.nan_mode = ::llvm::dyn_cast_or_null>(value); return; } } void TosaArgMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); if (prop.nan_mode) attrs.append("nan_mode", prop.nan_mode); } ::llvm::LogicalResult TosaArgMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getNanModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(attr, "nan_mode", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaArgMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.nan_mode))) return ::mlir::failure(); return ::mlir::success(); } void TosaArgMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); writer.writeAttribute(prop.nan_mode); } uint32_t TosaArgMaxOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } ::mlir::spirv::TosaExtNaNPropagationModeType TosaArgMaxOp::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } void TosaArgMaxOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaArgMaxOp::setNanMode(::mlir::spirv::TosaExtNaNPropagationModeType attrValue) { getProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaArgMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.getOrAddProperties().nan_mode = nan_mode; odsState.addTypes(output); } TosaArgMaxOp TosaArgMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArgMaxOp TosaArgMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaArgMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.getOrAddProperties().nan_mode = nan_mode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaArgMaxOp TosaArgMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArgMaxOp TosaArgMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaArgMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); odsState.addTypes(output); } TosaArgMaxOp TosaArgMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArgMaxOp TosaArgMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaArgMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaArgMaxOp TosaArgMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArgMaxOp TosaArgMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaArgMaxOp::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(); ::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."); } } TosaArgMaxOp TosaArgMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArgMaxOp TosaArgMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaArgMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaArgMaxOp TosaArgMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArgMaxOp TosaArgMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaArgMaxOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitOpError("requires attribute 'nan_mode'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(*this, tblgen_nan_mode, "nan_mode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps56(*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_SPIRVOps57(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())))) || ((std::max(int64_t(1), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() - int64_t(1)) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that output rank must be equal to max(1, rank(input))"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(input)"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaArgMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaArgMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_modeAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("nan_mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(nan_modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (nan_modeAttr) result.getOrAddProperties().nan_mode = nan_modeAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaArgMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "nan_mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getNanModeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); elidedAttrs.push_back("nan_mode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaArgMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaArgMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaArgMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaArithmeticRightShiftOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaArithmeticRightShiftOpGenericAdaptorBase::TosaArithmeticRightShiftOpGenericAdaptorBase(TosaArithmeticRightShiftOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} bool TosaArithmeticRightShiftOpGenericAdaptorBase::getRound() { auto attr = getRoundAttr(); return attr.getValue(); } } // namespace detail TosaArithmeticRightShiftOpAdaptor::TosaArithmeticRightShiftOpAdaptor(TosaArithmeticRightShiftOp op) : TosaArithmeticRightShiftOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaArithmeticRightShiftOpAdaptor::verify(::mlir::Location loc) { auto tblgen_round = getProperties().round; (void)tblgen_round; if (!tblgen_round) return emitError(loc, "'spirv.Tosa.ArithmeticRightShift' op requires attribute 'round'"); if (tblgen_round && !((::llvm::isa<::mlir::BoolAttr>(tblgen_round)))) return emitError(loc, "'spirv.Tosa.ArithmeticRightShift' op attribute 'round' failed to satisfy constraint: bool attribute"); return ::mlir::success(); } ::llvm::LogicalResult TosaArithmeticRightShiftOp::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.round; auto attr = dict.get("round"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `round` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaArithmeticRightShiftOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.round; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("round", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaArithmeticRightShiftOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.round.getAsOpaquePointer())); } std::optional TosaArithmeticRightShiftOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "round") return prop.round; return std::nullopt; } void TosaArithmeticRightShiftOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "round") { prop.round = ::llvm::dyn_cast_or_null>(value); return; } } void TosaArithmeticRightShiftOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.round) attrs.append("round", prop.round); } ::llvm::LogicalResult TosaArithmeticRightShiftOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getRoundAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "round", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaArithmeticRightShiftOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.round))) return ::mlir::failure(); return ::mlir::success(); } void TosaArithmeticRightShiftOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.round); } bool TosaArithmeticRightShiftOp::getRound() { auto attr = getRoundAttr(); return attr.getValue(); } void TosaArithmeticRightShiftOp::setRound(bool attrValue) { getProperties().round = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaArithmeticRightShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::BoolAttr round, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().round = round; odsState.addTypes(output); } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::BoolAttr round, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(round), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::BoolAttr round, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(round), std::forward(input1), std::forward(input2)); } void TosaArithmeticRightShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr round, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().round = round; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr round, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(round), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr round, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(round), std::forward(input1), std::forward(input2)); } void TosaArithmeticRightShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, bool round, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().round = odsBuilder.getBoolAttr(round); odsState.addTypes(output); } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, bool round, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(round), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, bool round, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(round), std::forward(input1), std::forward(input2)); } void TosaArithmeticRightShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, bool round, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().round = odsBuilder.getBoolAttr(round); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, bool round, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(round), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, bool round, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(round), std::forward(input1), std::forward(input2)); } void TosaArithmeticRightShiftOp::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(); ::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."); } } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaArithmeticRightShiftOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaArithmeticRightShiftOp TosaArithmeticRightShiftOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaArithmeticRightShiftOp::verifyInvariantsImpl() { auto tblgen_round = getProperties().round; (void)tblgen_round; if (!tblgen_round) return emitOpError("requires attribute 'round'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_round, "round"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*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_SPIRVOps58(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaArithmeticRightShiftOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaArithmeticRightShiftOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::BoolAttr roundAttr; ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("round")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(roundAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (roundAttr) result.getOrAddProperties().round = roundAttr; if (parser.parseComma()) return ::mlir::failure(); input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaArithmeticRightShiftOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "round"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getRoundAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("round"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaArithmeticRightShiftOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaArithmeticRightShiftOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaArithmeticRightShiftOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaAvgPool2DOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaAvgPool2DOpGenericAdaptorBase::TosaAvgPool2DOpGenericAdaptorBase(TosaAvgPool2DOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::DenseIntElementsAttr TosaAvgPool2DOpGenericAdaptorBase::getKernel() { auto attr = getKernelAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaAvgPool2DOpGenericAdaptorBase::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaAvgPool2DOpGenericAdaptorBase::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaAvgPool2DOpGenericAdaptorBase::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } } // namespace detail TosaAvgPool2DOpAdaptor::TosaAvgPool2DOpAdaptor(TosaAvgPool2DOp op) : TosaAvgPool2DOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaAvgPool2DOpAdaptor::verify(::mlir::Location loc) { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitError(loc, "'spirv.Tosa.AvgPool2D' op requires attribute 'acc_type'"); auto tblgen_kernel = getProperties().kernel; (void)tblgen_kernel; if (!tblgen_kernel) return emitError(loc, "'spirv.Tosa.AvgPool2D' op requires attribute 'kernel'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitError(loc, "'spirv.Tosa.AvgPool2D' op requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitError(loc, "'spirv.Tosa.AvgPool2D' op requires attribute 'stride'"); if (tblgen_kernel && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_kernel))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_kernel).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_kernel).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_kernel).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_kernel).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.AvgPool2D' op attribute 'kernel' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_stride && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_stride))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.AvgPool2D' op attribute 'stride' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_pad && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_pad))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getShape() == ::mlir::ArrayRef({4})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 0; }))))) return emitError(loc, "'spirv.Tosa.AvgPool2D' op attribute 'pad' failed to satisfy constraint: 32-bit signless int elements attribute of shape [4] Attr with type = spirv::TensorArmType all values must be >= 0"); if (tblgen_acc_type && !((::llvm::isa<::mlir::spirv::TosaExtAccTypeAttr>(tblgen_acc_type)))) return emitError(loc, "'spirv.Tosa.AvgPool2D' op attribute 'acc_type' failed to satisfy constraint: Tosa Ext Acculumator Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaAvgPool2DOp::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.acc_type; auto attr = dict.get("acc_type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `acc_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.kernel; auto attr = dict.get("kernel"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `kernel` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.pad; auto attr = dict.get("pad"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `pad` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.stride; auto attr = dict.get("stride"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `stride` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaAvgPool2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.acc_type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("acc_type", propStorage)); } { const auto &propStorage = prop.kernel; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("kernel", propStorage)); } { const auto &propStorage = prop.pad; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("pad", propStorage)); } { const auto &propStorage = prop.stride; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("stride", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaAvgPool2DOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.acc_type.getAsOpaquePointer()), llvm::hash_value(prop.kernel.getAsOpaquePointer()), llvm::hash_value(prop.pad.getAsOpaquePointer()), llvm::hash_value(prop.stride.getAsOpaquePointer())); } std::optional TosaAvgPool2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "acc_type") return prop.acc_type; if (name == "kernel") return prop.kernel; if (name == "pad") return prop.pad; if (name == "stride") return prop.stride; return std::nullopt; } void TosaAvgPool2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "acc_type") { prop.acc_type = ::llvm::dyn_cast_or_null>(value); return; } if (name == "kernel") { prop.kernel = ::llvm::dyn_cast_or_null>(value); return; } if (name == "pad") { prop.pad = ::llvm::dyn_cast_or_null>(value); return; } if (name == "stride") { prop.stride = ::llvm::dyn_cast_or_null>(value); return; } } void TosaAvgPool2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.acc_type) attrs.append("acc_type", prop.acc_type); if (prop.kernel) attrs.append("kernel", prop.kernel); if (prop.pad) attrs.append("pad", prop.pad); if (prop.stride) attrs.append("stride", prop.stride); } ::llvm::LogicalResult TosaAvgPool2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAccTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(attr, "acc_type", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getKernelAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "kernel", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getPadAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps40(attr, "pad", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getStrideAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "stride", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaAvgPool2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.acc_type))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.kernel))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.pad))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.stride))) return ::mlir::failure(); return ::mlir::success(); } void TosaAvgPool2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.acc_type); writer.writeAttribute(prop.kernel); writer.writeAttribute(prop.pad); writer.writeAttribute(prop.stride); } ::mlir::DenseIntElementsAttr TosaAvgPool2DOp::getKernel() { auto attr = getKernelAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaAvgPool2DOp::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaAvgPool2DOp::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaAvgPool2DOp::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } void TosaAvgPool2DOp::setAccType(::mlir::spirv::TosaExtAccType attrValue) { getProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaAvgPool2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { odsState.addOperands(input); odsState.addOperands(input_zp); odsState.addOperands(output_zp); odsState.getOrAddProperties().kernel = kernel; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().acc_type = acc_type; odsState.addTypes(output); } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(acc_type), std::forward(input), std::forward(input_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(acc_type), std::forward(input), std::forward(input_zp), std::forward(output_zp)); } void TosaAvgPool2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { odsState.addOperands(input); odsState.addOperands(input_zp); odsState.addOperands(output_zp); odsState.getOrAddProperties().kernel = kernel; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().acc_type = acc_type; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(acc_type), std::forward(input), std::forward(input_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(acc_type), std::forward(input), std::forward(input_zp), std::forward(output_zp)); } void TosaAvgPool2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccType acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { odsState.addOperands(input); odsState.addOperands(input_zp); odsState.addOperands(output_zp); odsState.getOrAddProperties().kernel = kernel; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.addTypes(output); } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccType acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(acc_type), std::forward(input), std::forward(input_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccType acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(acc_type), std::forward(input), std::forward(input_zp), std::forward(output_zp)); } void TosaAvgPool2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccType acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { odsState.addOperands(input); odsState.addOperands(input_zp); odsState.addOperands(output_zp); odsState.getOrAddProperties().kernel = kernel; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccType acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(acc_type), std::forward(input), std::forward(input_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtAccType acc_type, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(acc_type), std::forward(input), std::forward(input_zp), std::forward(output_zp)); } void TosaAvgPool2DOp::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(); ::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."); } } TosaAvgPool2DOp TosaAvgPool2DOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAvgPool2DOp TosaAvgPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaAvgPool2DOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaAvgPool2DOp TosaAvgPool2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaAvgPool2DOp TosaAvgPool2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaAvgPool2DOp::verifyInvariantsImpl() { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitOpError("requires attribute 'acc_type'"); auto tblgen_kernel = getProperties().kernel; (void)tblgen_kernel; if (!tblgen_kernel) return emitOpError("requires attribute 'kernel'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitOpError("requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitOpError("requires attribute 'stride'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_kernel, "kernel"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_stride, "stride"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps40(*this, tblgen_pad, "pad"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(*this, tblgen_acc_type, "acc_type"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps59(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps60(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps60(*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_SPIRVOps59(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT32] when type has value 8-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT32] when type has value 16-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16,::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16,FP32] when type has value 16-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value bfloat16 type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value 32-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E4M3FN type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E5M2 type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(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 {input, input_zp, output, output_zp} have same element type"); if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) return emitOpError("failed to verify that shapes of input and output must satisfy [N,*,*,C] and [N,*,*,C]"); if (!(((getPad().getValues()[0].getSExtValue() < getKernel().getValues()[0].getSExtValue())) && ((getPad().getValues()[1].getSExtValue() < getKernel().getValues()[0].getSExtValue())) && ((getPad().getValues()[2].getSExtValue() < getKernel().getValues()[1].getSExtValue())) && ((getPad().getValues()[3].getSExtValue() < getKernel().getValues()[1].getSExtValue())))) return emitOpError("failed to verify that op pad values must satisfy pad_top/pad_bottom < kernel_y and pad_left/pad_right < kernel_x"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaAvgPool2DOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult TosaAvgPool2DOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::DenseIntElementsAttr kernelAttr; ::mlir::DenseIntElementsAttr strideAttr; ::mlir::DenseIntElementsAttr padAttr; ::mlir::spirv::TosaExtAccTypeAttr acc_typeAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_zpOperands(&input_zpRawOperand, 1); ::llvm::SMLoc input_zpOperandsLoc; (void)input_zpOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand output_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> output_zpOperands(&output_zpRawOperand, 1); ::llvm::SMLoc output_zpOperandsLoc; (void)output_zpOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("kernel")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, kernelAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().kernel = kernelAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("stride")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, strideAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().stride = strideAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("pad")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, padAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().pad = padAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("acc_type")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(acc_typeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (acc_typeAttr) result.getOrAddProperties().acc_type = acc_typeAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_zpRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); output_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(output_zpRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(inputOperands, input_zpOperands, output_zpOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaAvgPool2DOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "kernel"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getKernelAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "stride"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getStrideAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "pad"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getPadAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "acc_type"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getAccTypeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputZp(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOutputZp(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("kernel"); elidedAttrs.push_back("stride"); elidedAttrs.push_back("pad"); elidedAttrs.push_back("acc_type"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaAvgPool2DOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaAvgPool2DOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaAvgPool2DOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaBitwiseAndOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaBitwiseAndOpGenericAdaptorBase::TosaBitwiseAndOpGenericAdaptorBase(TosaBitwiseAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaBitwiseAndOpAdaptor::TosaBitwiseAndOpAdaptor(TosaBitwiseAndOp op) : TosaBitwiseAndOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaBitwiseAndOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaBitwiseAndOp::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 TosaBitwiseAndOp::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 TosaBitwiseAndOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaBitwiseAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaBitwiseAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaBitwiseAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaBitwiseAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaBitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaBitwiseAndOp TosaBitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseAndOp TosaBitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaBitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaBitwiseAndOp TosaBitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseAndOp TosaBitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaBitwiseAndOp::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); } TosaBitwiseAndOp TosaBitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseAndOp TosaBitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaBitwiseAndOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaBitwiseAndOp TosaBitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseAndOp TosaBitwiseAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaBitwiseAndOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*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_SPIRVOps58(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaBitwiseAndOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaBitwiseAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaBitwiseAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaBitwiseAndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaBitwiseAndOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaBitwiseNotOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaBitwiseNotOpGenericAdaptorBase::TosaBitwiseNotOpGenericAdaptorBase(TosaBitwiseNotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaBitwiseNotOpAdaptor::TosaBitwiseNotOpAdaptor(TosaBitwiseNotOp op) : TosaBitwiseNotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaBitwiseNotOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaBitwiseNotOp::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 TosaBitwiseNotOp::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 TosaBitwiseNotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaBitwiseNotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaBitwiseNotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaBitwiseNotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaBitwiseNotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaBitwiseNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaBitwiseNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaBitwiseNotOp::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); } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaBitwiseNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaBitwiseNotOp::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); } TosaBitwiseNotOp TosaBitwiseNotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaBitwiseNotOp::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(TosaBitwiseNotOp::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)."); } } TosaBitwiseNotOp TosaBitwiseNotOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaBitwiseNotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaBitwiseNotOp TosaBitwiseNotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseNotOp TosaBitwiseNotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaBitwiseNotOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaBitwiseNotOp::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)."); } } TosaBitwiseNotOp TosaBitwiseNotOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseNotOp TosaBitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaBitwiseNotOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*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_SPIRVOps58(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaBitwiseNotOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaBitwiseNotOp::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 TosaBitwiseNotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaBitwiseNotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaBitwiseNotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaBitwiseNotOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaBitwiseOrOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaBitwiseOrOpGenericAdaptorBase::TosaBitwiseOrOpGenericAdaptorBase(TosaBitwiseOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaBitwiseOrOpAdaptor::TosaBitwiseOrOpAdaptor(TosaBitwiseOrOp op) : TosaBitwiseOrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaBitwiseOrOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaBitwiseOrOp::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 TosaBitwiseOrOp::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 TosaBitwiseOrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaBitwiseOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaBitwiseOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaBitwiseOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaBitwiseOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaBitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaBitwiseOrOp TosaBitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseOrOp TosaBitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaBitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaBitwiseOrOp TosaBitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseOrOp TosaBitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaBitwiseOrOp::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); } TosaBitwiseOrOp TosaBitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseOrOp TosaBitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaBitwiseOrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaBitwiseOrOp TosaBitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseOrOp TosaBitwiseOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaBitwiseOrOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*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_SPIRVOps58(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaBitwiseOrOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaBitwiseOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaBitwiseOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaBitwiseOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaBitwiseOrOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaBitwiseXorOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaBitwiseXorOpGenericAdaptorBase::TosaBitwiseXorOpGenericAdaptorBase(TosaBitwiseXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaBitwiseXorOpAdaptor::TosaBitwiseXorOpAdaptor(TosaBitwiseXorOp op) : TosaBitwiseXorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaBitwiseXorOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaBitwiseXorOp::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 TosaBitwiseXorOp::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 TosaBitwiseXorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaBitwiseXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaBitwiseXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaBitwiseXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaBitwiseXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaBitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaBitwiseXorOp TosaBitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseXorOp TosaBitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaBitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaBitwiseXorOp TosaBitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseXorOp TosaBitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaBitwiseXorOp::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); } TosaBitwiseXorOp TosaBitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseXorOp TosaBitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaBitwiseXorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaBitwiseXorOp TosaBitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaBitwiseXorOp TosaBitwiseXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaBitwiseXorOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*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_SPIRVOps58(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaBitwiseXorOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaBitwiseXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaBitwiseXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaBitwiseXorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaBitwiseXorOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaCastOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaCastOpGenericAdaptorBase::TosaCastOpGenericAdaptorBase(TosaCastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaCastOpAdaptor::TosaCastOpAdaptor(TosaCastOp op) : TosaCastOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaCastOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaCastOp::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 TosaCastOp::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 TosaCastOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaCastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaCastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaCastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaCastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input) { odsState.addOperands(input); odsState.addTypes(output); } TosaCastOp TosaCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCastOp TosaCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input)); } void TosaCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) { odsState.addOperands(input); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaCastOp TosaCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCastOp TosaCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input)); } void TosaCastOp::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); } TosaCastOp TosaCastOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCastOp TosaCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaCastOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaCastOp TosaCastOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCastOp TosaCastOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaCastOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps61(*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_SPIRVOps62(*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 {input, output} have same shape"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSResults(0).begin()))))))))) return emitOpError("failed to verify that if input has type 16-bit float then output must have a type in [32-bit float,16-bit signless integer,32-bit signless integer,8-bit signless integer,f8E4M3FN type,f8E5M2 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSResults(0).begin()))))))))) return emitOpError("failed to verify that if input has type 32-bit float then output must have a type in [16-bit float,16-bit signless integer,32-bit signless integer,8-bit signless integer,bfloat16 type,f8E4M3FN type,f8E5M2 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(1)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin()))))))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then output must have a type in [16-bit float,32-bit float,32-bit signless integer,8-bit signless integer,bool,bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(32))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(1)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin()))))))))) return emitOpError("failed to verify that if input has type 32-bit signless integer then output must have a type in [16-bit float,32-bit float,16-bit signless integer,8-bit signless integer,bool,bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(1)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin()))))))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then output must have a type in [16-bit float,32-bit float,16-bit signless integer,32-bit signless integer,bool,bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(1))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8))))))) return emitOpError("failed to verify that if input has type bool then output must have a type in [16-bit signless integer,32-bit signless integer,8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSResults(0).begin()))))))))) return emitOpError("failed to verify that if input has type bfloat16 type then output must have a type in [32-bit float,16-bit signless integer,32-bit signless integer,8-bit signless integer,f8E4M3FN type,f8E5M2 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin()))))))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then output must have a type in [16-bit float,32-bit float,bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin()))))))))) return emitOpError("failed to verify that if input has type f8E5M2 type then output must have a type in [16-bit float,32-bit float,bfloat16 type]"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaCastOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaCastOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaCeilOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaCeilOpGenericAdaptorBase::TosaCeilOpGenericAdaptorBase(TosaCeilOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaCeilOpAdaptor::TosaCeilOpAdaptor(TosaCeilOp op) : TosaCeilOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaCeilOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaCeilOp::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 TosaCeilOp::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 TosaCeilOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaCeilOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaCeilOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaCeilOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaCeilOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaCeilOp TosaCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCeilOp TosaCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaCeilOp::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); } TosaCeilOp TosaCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCeilOp TosaCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaCeilOp TosaCeilOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCeilOp TosaCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaCeilOp::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); } TosaCeilOp TosaCeilOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCeilOp TosaCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaCeilOp::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(TosaCeilOp::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)."); } } TosaCeilOp TosaCeilOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCeilOp TosaCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaCeilOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaCeilOp TosaCeilOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCeilOp TosaCeilOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaCeilOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaCeilOp::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)."); } } TosaCeilOp TosaCeilOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCeilOp TosaCeilOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaCeilOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaCeilOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaCeilOp::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 TosaCeilOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaCeilOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaCeilOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaCeilOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaClampOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaClampOpGenericAdaptorBase::TosaClampOpGenericAdaptorBase(TosaClampOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::Attribute TosaClampOpGenericAdaptorBase::getMinVal() { auto attr = getMinValAttr(); return attr; } ::mlir::Attribute TosaClampOpGenericAdaptorBase::getMaxVal() { auto attr = getMaxValAttr(); return attr; } ::mlir::spirv::TosaExtNaNPropagationModeType TosaClampOpGenericAdaptorBase::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } } // namespace detail TosaClampOpAdaptor::TosaClampOpAdaptor(TosaClampOp op) : TosaClampOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaClampOpAdaptor::verify(::mlir::Location loc) { auto tblgen_max_val = getProperties().max_val; (void)tblgen_max_val; if (!tblgen_max_val) return emitError(loc, "'spirv.Tosa.Clamp' op requires attribute 'max_val'"); auto tblgen_min_val = getProperties().min_val; (void)tblgen_min_val; if (!tblgen_min_val) return emitError(loc, "'spirv.Tosa.Clamp' op requires attribute 'min_val'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitError(loc, "'spirv.Tosa.Clamp' op requires attribute 'nan_mode'"); if (tblgen_min_val && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_min_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_min_val).getType().isSignlessInteger(8)))) || (((::llvm::isa<::mlir::IntegerAttr>(tblgen_min_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_min_val).getType().isSignlessInteger(16)))) || (((::llvm::isa<::mlir::FloatAttr>(tblgen_min_val))) && ((::llvm::cast<::mlir::FloatAttr>(tblgen_min_val).getType().isF16()))) || (((::llvm::isa<::mlir::FloatAttr>(tblgen_min_val))) && ((::llvm::cast<::mlir::FloatAttr>(tblgen_min_val).getType().isF32()))) || (((::llvm::isa<::mlir::FloatAttr>(tblgen_min_val))) && ((::llvm::cast<::mlir::FloatAttr>(tblgen_min_val).getType().isBF16()))))) return emitError(loc, "'spirv.Tosa.Clamp' op attribute 'min_val' failed to satisfy constraint: 8-bit signless integer attribute or 16-bit signless integer attribute or 16-bit float attribute or 32-bit float attribute or 16-bit bfloat attribute"); if (tblgen_max_val && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_max_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_max_val).getType().isSignlessInteger(8)))) || (((::llvm::isa<::mlir::IntegerAttr>(tblgen_max_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_max_val).getType().isSignlessInteger(16)))) || (((::llvm::isa<::mlir::FloatAttr>(tblgen_max_val))) && ((::llvm::cast<::mlir::FloatAttr>(tblgen_max_val).getType().isF16()))) || (((::llvm::isa<::mlir::FloatAttr>(tblgen_max_val))) && ((::llvm::cast<::mlir::FloatAttr>(tblgen_max_val).getType().isF32()))) || (((::llvm::isa<::mlir::FloatAttr>(tblgen_max_val))) && ((::llvm::cast<::mlir::FloatAttr>(tblgen_max_val).getType().isBF16()))))) return emitError(loc, "'spirv.Tosa.Clamp' op attribute 'max_val' failed to satisfy constraint: 8-bit signless integer attribute or 16-bit signless integer attribute or 16-bit float attribute or 32-bit float attribute or 16-bit bfloat attribute"); if (tblgen_nan_mode && !((::llvm::isa<::mlir::spirv::TosaExtNaNPropagationModeTypeAttr>(tblgen_nan_mode)))) return emitError(loc, "'spirv.Tosa.Clamp' op attribute 'nan_mode' failed to satisfy constraint: Tosa Ext NaN Propoagation Mode Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaClampOp::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.max_val; auto attr = dict.get("max_val"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `max_val` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.min_val; auto attr = dict.get("min_val"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `min_val` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.nan_mode; auto attr = dict.get("nan_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `nan_mode` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaClampOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.max_val; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("max_val", propStorage)); } { const auto &propStorage = prop.min_val; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("min_val", propStorage)); } { const auto &propStorage = prop.nan_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("nan_mode", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaClampOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.max_val.getAsOpaquePointer()), llvm::hash_value(prop.min_val.getAsOpaquePointer()), llvm::hash_value(prop.nan_mode.getAsOpaquePointer())); } std::optional TosaClampOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "max_val") return prop.max_val; if (name == "min_val") return prop.min_val; if (name == "nan_mode") return prop.nan_mode; return std::nullopt; } void TosaClampOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "max_val") { prop.max_val = ::llvm::dyn_cast_or_null>(value); return; } if (name == "min_val") { prop.min_val = ::llvm::dyn_cast_or_null>(value); return; } if (name == "nan_mode") { prop.nan_mode = ::llvm::dyn_cast_or_null>(value); return; } } void TosaClampOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.max_val) attrs.append("max_val", prop.max_val); if (prop.min_val) attrs.append("min_val", prop.min_val); if (prop.nan_mode) attrs.append("nan_mode", prop.nan_mode); } ::llvm::LogicalResult TosaClampOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getMaxValAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps42(attr, "max_val", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getMinValAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps42(attr, "min_val", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getNanModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(attr, "nan_mode", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaClampOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.max_val))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.min_val))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.nan_mode))) return ::mlir::failure(); return ::mlir::success(); } void TosaClampOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.max_val); writer.writeAttribute(prop.min_val); writer.writeAttribute(prop.nan_mode); } ::mlir::Attribute TosaClampOp::getMinVal() { auto attr = getMinValAttr(); return attr; } ::mlir::Attribute TosaClampOp::getMaxVal() { auto attr = getMaxValAttr(); return attr; } ::mlir::spirv::TosaExtNaNPropagationModeType TosaClampOp::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } void TosaClampOp::setNanMode(::mlir::spirv::TosaExtNaNPropagationModeType attrValue) { getProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().min_val = min_val; odsState.getOrAddProperties().max_val = max_val; odsState.getOrAddProperties().nan_mode = nan_mode; odsState.addTypes(output); } TosaClampOp TosaClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); } void TosaClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().min_val = min_val; odsState.getOrAddProperties().max_val = max_val; odsState.getOrAddProperties().nan_mode = nan_mode; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaClampOp::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); } TosaClampOp TosaClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); } void TosaClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().min_val = min_val; odsState.getOrAddProperties().max_val = max_val; odsState.getOrAddProperties().nan_mode = nan_mode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaClampOp TosaClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); } void TosaClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().min_val = min_val; odsState.getOrAddProperties().max_val = max_val; odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); odsState.addTypes(output); } TosaClampOp TosaClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); } void TosaClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().min_val = min_val; odsState.getOrAddProperties().max_val = max_val; odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaClampOp::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); } TosaClampOp TosaClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); } void TosaClampOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().min_val = min_val; odsState.getOrAddProperties().max_val = max_val; odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaClampOp TosaClampOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(min_val), std::forward(max_val), std::forward(nan_mode), std::forward(input)); } void TosaClampOp::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(); ::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."); } } TosaClampOp TosaClampOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaClampOp::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(); ::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(TosaClampOp::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)."); } } TosaClampOp TosaClampOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaClampOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaClampOp TosaClampOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaClampOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaClampOp::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)."); } } TosaClampOp TosaClampOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClampOp TosaClampOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaClampOp::verifyInvariantsImpl() { auto tblgen_max_val = getProperties().max_val; (void)tblgen_max_val; if (!tblgen_max_val) return emitOpError("requires attribute 'max_val'"); auto tblgen_min_val = getProperties().min_val; (void)tblgen_min_val; if (!tblgen_min_val) return emitOpError("requires attribute 'min_val'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitOpError("requires attribute 'nan_mode'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps42(*this, tblgen_min_val, "min_val"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps42(*this, tblgen_max_val, "max_val"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(*this, tblgen_nan_mode, "nan_mode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps64(*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_SPIRVOps64(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input, output} have same type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf(getMinVal())) && (getElementTypeOrSelf(getMinVal())) == (getElementTypeOrSelf(getMaxVal())) && (getElementTypeOrSelf(getMaxVal())) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, output, min_val, max_val} have same element type"); if (!(!((((::llvm::isa<::mlir::FloatAttr>(getMinVal()))) && ((::llvm::cast<::mlir::FloatAttr>(getMinVal()).getValue().isNaN()))) || (((::llvm::isa<::mlir::FloatAttr>(getMaxVal()))) && ((::llvm::cast<::mlir::FloatAttr>(getMaxVal()).getValue().isNaN())))))) return emitOpError("failed to verify that min_val and max_val must not be NaN"); if (!(((!((::llvm::isa<::mlir::IntegerAttr>(getMinVal())))) || ((::llvm::cast<::mlir::IntegerAttr>(getMinVal()).getValue().sle(::llvm::cast<::mlir::IntegerAttr>(getMaxVal()).getValue())))) && ((!((::llvm::isa<::mlir::FloatAttr>(getMinVal())))) || ((::llvm::cast<::mlir::FloatAttr>(getMinVal()).getValue().compare(::llvm::cast<::mlir::FloatAttr>(getMaxVal()).getValue()) != ::llvm::APFloat::cmpGreaterThan))))) return emitOpError("failed to verify that min_val must be <= max_val"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaClampOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaClampOp::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 TosaClampOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::Attribute min_valAttr; ::mlir::Attribute max_valAttr; ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_modeAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("min_val")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseAttribute(min_valAttr, ::mlir::Type{})) return ::mlir::failure(); if (min_valAttr) result.getOrAddProperties().min_val = min_valAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("max_val")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseAttribute(max_valAttr, ::mlir::Type{})) return ::mlir::failure(); if (max_valAttr) result.getOrAddProperties().max_val = max_valAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("nan_mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(nan_modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (nan_modeAttr) result.getOrAddProperties().nan_mode = nan_modeAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaClampOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "min_val"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttribute(getMinValAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "max_val"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttribute(getMaxValAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "nan_mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getNanModeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("min_val"); elidedAttrs.push_back("max_val"); elidedAttrs.push_back("nan_mode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaClampOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaClampOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaClampOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaClzOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaClzOpGenericAdaptorBase::TosaClzOpGenericAdaptorBase(TosaClzOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaClzOpAdaptor::TosaClzOpAdaptor(TosaClzOp op) : TosaClzOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaClzOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaClzOp::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 TosaClzOp::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 TosaClzOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaClzOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaClzOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaClzOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaClzOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaClzOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaClzOp TosaClzOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClzOp TosaClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaClzOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaClzOp::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); } TosaClzOp TosaClzOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClzOp TosaClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaClzOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaClzOp TosaClzOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClzOp TosaClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaClzOp::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); } TosaClzOp TosaClzOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClzOp TosaClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaClzOp::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(TosaClzOp::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)."); } } TosaClzOp TosaClzOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClzOp TosaClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaClzOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaClzOp TosaClzOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClzOp TosaClzOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaClzOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaClzOp::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)."); } } TosaClzOp TosaClzOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaClzOp TosaClzOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaClzOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps65(*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_SPIRVOps65(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaClzOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaClzOp::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 TosaClzOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaClzOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaClzOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaClzOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaConcatOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaConcatOpGenericAdaptorBase::TosaConcatOpGenericAdaptorBase(TosaConcatOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair TosaConcatOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {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 - 0) / 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 TosaConcatOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } } // namespace detail TosaConcatOpAdaptor::TosaConcatOpAdaptor(TosaConcatOp op) : TosaConcatOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaConcatOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.Concat' op requires attribute 'axis'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.Concat' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); return ::mlir::success(); } std::pair TosaConcatOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {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() - 0) / 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 TosaConcatOp::getInput1Mutable() { auto range = getODSOperandIndexAndLength(0); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult TosaConcatOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaConcatOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaConcatOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer())); } std::optional TosaConcatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; return std::nullopt; } void TosaConcatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } } void TosaConcatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); } ::llvm::LogicalResult TosaConcatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaConcatOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); return ::mlir::success(); } void TosaConcatOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); } uint32_t TosaConcatOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } void TosaConcatOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::ValueRange input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = axis; odsState.addTypes(output); } TosaConcatOp TosaConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::ValueRange input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConcatOp TosaConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::ValueRange input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input1)); } void TosaConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::ValueRange input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = axis; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaConcatOp TosaConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::ValueRange input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConcatOp TosaConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::ValueRange input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input1)); } void TosaConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::ValueRange input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.addTypes(output); } TosaConcatOp TosaConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::ValueRange input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConcatOp TosaConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::ValueRange input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input1)); } void TosaConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::ValueRange input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaConcatOp TosaConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::ValueRange input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConcatOp TosaConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::ValueRange input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input1)); } void TosaConcatOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { odsState.addOperands(operands); odsState.addAttributes(attributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } TosaConcatOp TosaConcatOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConcatOp TosaConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaConcatOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { odsState.addOperands(operands); odsState.useProperties(const_cast(properties)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaConcatOp TosaConcatOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConcatOp TosaConcatOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaConcatOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps66(*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_SPIRVOps61(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((static_cast(this->getODSOperands(0).getTypes().size()) >= 1))) return emitOpError("failed to verify that variadic input1 must has at least 1 elements"); if (!((::llvm::all_of(this->getODSOperands(0).getTypes(), [&](::mlir::Type t) { return ::llvm::cast<::mlir::ShapedType>(t).getElementType() == getElementTypeOrSelf((*this->getODSResults(0).begin())); })))) return emitOpError("failed to verify that all elements of variadic input1 must have same element type"); if (!((::llvm::all_of(this->getODSOperands(0).getTypes(), [&](::mlir::Type t) { return ::llvm::cast<::mlir::ShapedType>(t).hasRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank() && ::llvm::cast<::mlir::ShapedType>(t).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank(); })))) return emitOpError("failed to verify that all elements of variadic input1 must have same element type"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(output)"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaConcatOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult TosaConcatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> input1Operands; ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperandList(input1Operands)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaConcatOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaConcatOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaConcatOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaConcatOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaConv2DOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaConv2DOpGenericAdaptorBase::TosaConv2DOpGenericAdaptorBase(TosaConv2DOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::DenseIntElementsAttr TosaConv2DOpGenericAdaptorBase::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaConv2DOpGenericAdaptorBase::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaConv2DOpGenericAdaptorBase::getDilation() { auto attr = getDilationAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaConv2DOpGenericAdaptorBase::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } bool TosaConv2DOpGenericAdaptorBase::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } } // namespace detail TosaConv2DOpAdaptor::TosaConv2DOpAdaptor(TosaConv2DOp op) : TosaConv2DOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaConv2DOpAdaptor::verify(::mlir::Location loc) { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitError(loc, "'spirv.Tosa.Conv2D' op requires attribute 'acc_type'"); auto tblgen_dilation = getProperties().dilation; (void)tblgen_dilation; if (!tblgen_dilation) return emitError(loc, "'spirv.Tosa.Conv2D' op requires attribute 'dilation'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitError(loc, "'spirv.Tosa.Conv2D' op requires attribute 'local_bound'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitError(loc, "'spirv.Tosa.Conv2D' op requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitError(loc, "'spirv.Tosa.Conv2D' op requires attribute 'stride'"); if (tblgen_pad && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_pad))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getShape() == ::mlir::ArrayRef({4})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 0; }))))) return emitError(loc, "'spirv.Tosa.Conv2D' op attribute 'pad' failed to satisfy constraint: 32-bit signless int elements attribute of shape [4] Attr with type = spirv::TensorArmType all values must be >= 0"); if (tblgen_stride && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_stride))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.Conv2D' op attribute 'stride' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_dilation && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilation))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilation).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilation).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_dilation).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_dilation).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.Conv2D' op attribute 'dilation' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_acc_type && !((::llvm::isa<::mlir::spirv::TosaExtAccTypeAttr>(tblgen_acc_type)))) return emitError(loc, "'spirv.Tosa.Conv2D' op attribute 'acc_type' failed to satisfy constraint: Tosa Ext Acculumator Type"); if (tblgen_local_bound && !((::llvm::isa<::mlir::BoolAttr>(tblgen_local_bound)))) return emitError(loc, "'spirv.Tosa.Conv2D' op attribute 'local_bound' failed to satisfy constraint: bool attribute"); return ::mlir::success(); } ::llvm::LogicalResult TosaConv2DOp::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.acc_type; auto attr = dict.get("acc_type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `acc_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.dilation; auto attr = dict.get("dilation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `dilation` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.local_bound; auto attr = dict.get("local_bound"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `local_bound` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.pad; auto attr = dict.get("pad"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `pad` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.stride; auto attr = dict.get("stride"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `stride` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaConv2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.acc_type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("acc_type", propStorage)); } { const auto &propStorage = prop.dilation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("dilation", propStorage)); } { const auto &propStorage = prop.local_bound; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("local_bound", propStorage)); } { const auto &propStorage = prop.pad; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("pad", propStorage)); } { const auto &propStorage = prop.stride; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("stride", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaConv2DOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.acc_type.getAsOpaquePointer()), llvm::hash_value(prop.dilation.getAsOpaquePointer()), llvm::hash_value(prop.local_bound.getAsOpaquePointer()), llvm::hash_value(prop.pad.getAsOpaquePointer()), llvm::hash_value(prop.stride.getAsOpaquePointer())); } std::optional TosaConv2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "acc_type") return prop.acc_type; if (name == "dilation") return prop.dilation; if (name == "local_bound") return prop.local_bound; if (name == "pad") return prop.pad; if (name == "stride") return prop.stride; return std::nullopt; } void TosaConv2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "acc_type") { prop.acc_type = ::llvm::dyn_cast_or_null>(value); return; } if (name == "dilation") { prop.dilation = ::llvm::dyn_cast_or_null>(value); return; } if (name == "local_bound") { prop.local_bound = ::llvm::dyn_cast_or_null>(value); return; } if (name == "pad") { prop.pad = ::llvm::dyn_cast_or_null>(value); return; } if (name == "stride") { prop.stride = ::llvm::dyn_cast_or_null>(value); return; } } void TosaConv2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.acc_type) attrs.append("acc_type", prop.acc_type); if (prop.dilation) attrs.append("dilation", prop.dilation); if (prop.local_bound) attrs.append("local_bound", prop.local_bound); if (prop.pad) attrs.append("pad", prop.pad); if (prop.stride) attrs.append("stride", prop.stride); } ::llvm::LogicalResult TosaConv2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAccTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(attr, "acc_type", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getDilationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "dilation", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLocalBoundAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "local_bound", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getPadAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps40(attr, "pad", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getStrideAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "stride", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaConv2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.acc_type))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.dilation))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.local_bound))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.pad))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.stride))) return ::mlir::failure(); return ::mlir::success(); } void TosaConv2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.acc_type); writer.writeAttribute(prop.dilation); writer.writeAttribute(prop.local_bound); writer.writeAttribute(prop.pad); writer.writeAttribute(prop.stride); } ::mlir::DenseIntElementsAttr TosaConv2DOp::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaConv2DOp::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaConv2DOp::getDilation() { auto attr = getDilationAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaConv2DOp::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } bool TosaConv2DOp::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } void TosaConv2DOp::setAccType(::mlir::spirv::TosaExtAccType attrValue) { getProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaConv2DOp::setLocalBound(bool attrValue) { getProperties().local_bound = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = acc_type; odsState.getOrAddProperties().local_bound = local_bound; odsState.addTypes(output); } TosaConv2DOp TosaConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv2DOp TosaConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = acc_type; odsState.getOrAddProperties().local_bound = local_bound; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaConv2DOp TosaConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv2DOp TosaConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); odsState.addTypes(output); } TosaConv2DOp TosaConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv2DOp TosaConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaConv2DOp TosaConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv2DOp TosaConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaConv2DOp::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(); ::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."); } } TosaConv2DOp TosaConv2DOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv2DOp TosaConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaConv2DOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaConv2DOp TosaConv2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv2DOp TosaConv2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaConv2DOp::verifyInvariantsImpl() { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitOpError("requires attribute 'acc_type'"); auto tblgen_dilation = getProperties().dilation; (void)tblgen_dilation; if (!tblgen_dilation) return emitOpError("requires attribute 'dilation'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitOpError("requires attribute 'local_bound'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitOpError("requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitOpError("requires attribute 'stride'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps40(*this, tblgen_pad, "pad"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_stride, "stride"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_dilation, "dilation"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(*this, tblgen_acc_type, "acc_type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_local_bound, "local_bound"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps59(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps67(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps68(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps60(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup4 = getODSOperands(4); for (auto v : valueGroup4) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps69(*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_SPIRVOps70(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(3)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) && ((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == 1))))) return emitOpError("failed to verify that shapes of input, weight, bias, and output must satisfy [N,IH,IW,IC], [OC,KH,KW,IC], [OC/1], [N,OH,OW,OC]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then output must have a type in [32-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(64)))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then output must have a type in [64-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then output must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then output must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type f8E5M2 type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then weight must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then weight must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then weight must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then weight must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then weight must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then weight must have a type in [f8E4M3FN type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type f8E5M2 type then weight must have a type in [f8E5M2 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT32] when type has value 8-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT48}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT48] when type has value 16-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16,::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16,FP32] when type has value 16-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value bfloat16 type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value 32-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E4M3FN type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E5M2 type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin())))))) return emitOpError("failed to verify that all of {bias, output} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, input_zp} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin())))))) return emitOpError("failed to verify that all of {weight, weight_zp} have same element type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaConv2DOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult TosaConv2DOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::DenseIntElementsAttr padAttr; ::mlir::DenseIntElementsAttr strideAttr; ::mlir::DenseIntElementsAttr dilationAttr; ::mlir::spirv::TosaExtAccTypeAttr acc_typeAttr; ::mlir::BoolAttr local_boundAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand weightRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> weightOperands(&weightRawOperand, 1); ::llvm::SMLoc weightOperandsLoc; (void)weightOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand biasRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> biasOperands(&biasRawOperand, 1); ::llvm::SMLoc biasOperandsLoc; (void)biasOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_zpOperands(&input_zpRawOperand, 1); ::llvm::SMLoc input_zpOperandsLoc; (void)input_zpOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand weight_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> weight_zpOperands(&weight_zpRawOperand, 1); ::llvm::SMLoc weight_zpOperandsLoc; (void)weight_zpOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("pad")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, padAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().pad = padAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("stride")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, strideAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().stride = strideAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("dilation")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, dilationAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().dilation = dilationAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("acc_type")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(acc_typeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (acc_typeAttr) result.getOrAddProperties().acc_type = acc_typeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("local_bound")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(local_boundAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (local_boundAttr) result.getOrAddProperties().local_bound = local_boundAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); weightOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(weightRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); biasOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(biasRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_zpRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); weight_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(weight_zpRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(inputOperands, weightOperands, biasOperands, input_zpOperands, weight_zpOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaConv2DOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "pad"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getPadAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "stride"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getStrideAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "dilation"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getDilationAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "acc_type"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getAccTypeAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "local_bound"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getLocalBoundAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getWeight(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getBias(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputZp(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getWeightZp(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("pad"); elidedAttrs.push_back("stride"); elidedAttrs.push_back("dilation"); elidedAttrs.push_back("acc_type"); elidedAttrs.push_back("local_bound"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaConv2DOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaConv2DOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaConv2DOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaConv3DOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaConv3DOpGenericAdaptorBase::TosaConv3DOpGenericAdaptorBase(TosaConv3DOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::DenseIntElementsAttr TosaConv3DOpGenericAdaptorBase::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaConv3DOpGenericAdaptorBase::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaConv3DOpGenericAdaptorBase::getDilation() { auto attr = getDilationAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaConv3DOpGenericAdaptorBase::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } bool TosaConv3DOpGenericAdaptorBase::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } } // namespace detail TosaConv3DOpAdaptor::TosaConv3DOpAdaptor(TosaConv3DOp op) : TosaConv3DOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaConv3DOpAdaptor::verify(::mlir::Location loc) { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitError(loc, "'spirv.Tosa.Conv3D' op requires attribute 'acc_type'"); auto tblgen_dilation = getProperties().dilation; (void)tblgen_dilation; if (!tblgen_dilation) return emitError(loc, "'spirv.Tosa.Conv3D' op requires attribute 'dilation'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitError(loc, "'spirv.Tosa.Conv3D' op requires attribute 'local_bound'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitError(loc, "'spirv.Tosa.Conv3D' op requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitError(loc, "'spirv.Tosa.Conv3D' op requires attribute 'stride'"); if (tblgen_pad && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_pad))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getShape() == ::mlir::ArrayRef({6})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 0; }))))) return emitError(loc, "'spirv.Tosa.Conv3D' op attribute 'pad' failed to satisfy constraint: 32-bit signless int elements attribute of shape [6] Attr with type = spirv::TensorArmType all values must be >= 0"); if (tblgen_stride && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_stride))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getShape() == ::mlir::ArrayRef({3})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.Conv3D' op attribute 'stride' failed to satisfy constraint: 32-bit signless int elements attribute of shape [3] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_dilation && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilation))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilation).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilation).getType().getShape() == ::mlir::ArrayRef({3})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_dilation).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_dilation).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.Conv3D' op attribute 'dilation' failed to satisfy constraint: 32-bit signless int elements attribute of shape [3] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_acc_type && !((::llvm::isa<::mlir::spirv::TosaExtAccTypeAttr>(tblgen_acc_type)))) return emitError(loc, "'spirv.Tosa.Conv3D' op attribute 'acc_type' failed to satisfy constraint: Tosa Ext Acculumator Type"); if (tblgen_local_bound && !((::llvm::isa<::mlir::BoolAttr>(tblgen_local_bound)))) return emitError(loc, "'spirv.Tosa.Conv3D' op attribute 'local_bound' failed to satisfy constraint: bool attribute"); return ::mlir::success(); } ::llvm::LogicalResult TosaConv3DOp::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.acc_type; auto attr = dict.get("acc_type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `acc_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.dilation; auto attr = dict.get("dilation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `dilation` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.local_bound; auto attr = dict.get("local_bound"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `local_bound` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.pad; auto attr = dict.get("pad"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `pad` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.stride; auto attr = dict.get("stride"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `stride` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaConv3DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.acc_type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("acc_type", propStorage)); } { const auto &propStorage = prop.dilation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("dilation", propStorage)); } { const auto &propStorage = prop.local_bound; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("local_bound", propStorage)); } { const auto &propStorage = prop.pad; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("pad", propStorage)); } { const auto &propStorage = prop.stride; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("stride", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaConv3DOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.acc_type.getAsOpaquePointer()), llvm::hash_value(prop.dilation.getAsOpaquePointer()), llvm::hash_value(prop.local_bound.getAsOpaquePointer()), llvm::hash_value(prop.pad.getAsOpaquePointer()), llvm::hash_value(prop.stride.getAsOpaquePointer())); } std::optional TosaConv3DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "acc_type") return prop.acc_type; if (name == "dilation") return prop.dilation; if (name == "local_bound") return prop.local_bound; if (name == "pad") return prop.pad; if (name == "stride") return prop.stride; return std::nullopt; } void TosaConv3DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "acc_type") { prop.acc_type = ::llvm::dyn_cast_or_null>(value); return; } if (name == "dilation") { prop.dilation = ::llvm::dyn_cast_or_null>(value); return; } if (name == "local_bound") { prop.local_bound = ::llvm::dyn_cast_or_null>(value); return; } if (name == "pad") { prop.pad = ::llvm::dyn_cast_or_null>(value); return; } if (name == "stride") { prop.stride = ::llvm::dyn_cast_or_null>(value); return; } } void TosaConv3DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.acc_type) attrs.append("acc_type", prop.acc_type); if (prop.dilation) attrs.append("dilation", prop.dilation); if (prop.local_bound) attrs.append("local_bound", prop.local_bound); if (prop.pad) attrs.append("pad", prop.pad); if (prop.stride) attrs.append("stride", prop.stride); } ::llvm::LogicalResult TosaConv3DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAccTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(attr, "acc_type", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getDilationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps44(attr, "dilation", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLocalBoundAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "local_bound", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getPadAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps43(attr, "pad", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getStrideAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps44(attr, "stride", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaConv3DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.acc_type))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.dilation))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.local_bound))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.pad))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.stride))) return ::mlir::failure(); return ::mlir::success(); } void TosaConv3DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.acc_type); writer.writeAttribute(prop.dilation); writer.writeAttribute(prop.local_bound); writer.writeAttribute(prop.pad); writer.writeAttribute(prop.stride); } ::mlir::DenseIntElementsAttr TosaConv3DOp::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaConv3DOp::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaConv3DOp::getDilation() { auto attr = getDilationAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaConv3DOp::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } bool TosaConv3DOp::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } void TosaConv3DOp::setAccType(::mlir::spirv::TosaExtAccType attrValue) { getProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaConv3DOp::setLocalBound(bool attrValue) { getProperties().local_bound = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaConv3DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = acc_type; odsState.getOrAddProperties().local_bound = local_bound; odsState.addTypes(output); } TosaConv3DOp TosaConv3DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv3DOp TosaConv3DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaConv3DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = acc_type; odsState.getOrAddProperties().local_bound = local_bound; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaConv3DOp TosaConv3DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv3DOp TosaConv3DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaConv3DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); odsState.addTypes(output); } TosaConv3DOp TosaConv3DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv3DOp TosaConv3DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaConv3DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaConv3DOp TosaConv3DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv3DOp TosaConv3DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaConv3DOp::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(); ::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."); } } TosaConv3DOp TosaConv3DOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv3DOp TosaConv3DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaConv3DOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaConv3DOp TosaConv3DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaConv3DOp TosaConv3DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaConv3DOp::verifyInvariantsImpl() { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitOpError("requires attribute 'acc_type'"); auto tblgen_dilation = getProperties().dilation; (void)tblgen_dilation; if (!tblgen_dilation) return emitOpError("requires attribute 'dilation'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitOpError("requires attribute 'local_bound'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitOpError("requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitOpError("requires attribute 'stride'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps43(*this, tblgen_pad, "pad"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps44(*this, tblgen_stride, "stride"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps44(*this, tblgen_dilation, "dilation"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(*this, tblgen_acc_type, "acc_type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_local_bound, "local_bound"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps71(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps72(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps68(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps60(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup4 = getODSOperands(4); for (auto v : valueGroup4) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps69(*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_SPIRVOps73(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(4)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(4)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) && ((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == 1))))) return emitOpError("failed to verify that shapes of input, weight, bias, and output must satisfy [N,ID,IH,IW,IC], [OC,KD,KH,KW,IC], [OC/1], [N,OD,OH,OW,OC]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then output must have a type in [32-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(64)))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then output must have a type in [64-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then output must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then output must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type f8E5M2 type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then weight must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then weight must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then weight must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then weight must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then weight must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then weight must have a type in [f8E4M3FN type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type f8E5M2 type then weight must have a type in [f8E5M2 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT32] when type has value 8-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT48}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT48] when type has value 16-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16,::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16,FP32] when type has value 16-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value bfloat16 type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value 32-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E4M3FN type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E5M2 type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin())))))) return emitOpError("failed to verify that all of {bias, output} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, input_zp} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin())))))) return emitOpError("failed to verify that all of {weight, weight_zp} have same element type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaConv3DOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult TosaConv3DOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::DenseIntElementsAttr padAttr; ::mlir::DenseIntElementsAttr strideAttr; ::mlir::DenseIntElementsAttr dilationAttr; ::mlir::spirv::TosaExtAccTypeAttr acc_typeAttr; ::mlir::BoolAttr local_boundAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand weightRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> weightOperands(&weightRawOperand, 1); ::llvm::SMLoc weightOperandsLoc; (void)weightOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand biasRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> biasOperands(&biasRawOperand, 1); ::llvm::SMLoc biasOperandsLoc; (void)biasOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_zpOperands(&input_zpRawOperand, 1); ::llvm::SMLoc input_zpOperandsLoc; (void)input_zpOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand weight_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> weight_zpOperands(&weight_zpRawOperand, 1); ::llvm::SMLoc weight_zpOperandsLoc; (void)weight_zpOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("pad")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, padAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().pad = padAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("stride")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, strideAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().stride = strideAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("dilation")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, dilationAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().dilation = dilationAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("acc_type")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(acc_typeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (acc_typeAttr) result.getOrAddProperties().acc_type = acc_typeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("local_bound")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(local_boundAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (local_boundAttr) result.getOrAddProperties().local_bound = local_boundAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); weightOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(weightRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); biasOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(biasRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_zpRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); weight_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(weight_zpRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(inputOperands, weightOperands, biasOperands, input_zpOperands, weight_zpOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaConv3DOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "pad"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getPadAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "stride"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getStrideAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "dilation"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getDilationAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "acc_type"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getAccTypeAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "local_bound"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getLocalBoundAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getWeight(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getBias(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputZp(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getWeightZp(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("pad"); elidedAttrs.push_back("stride"); elidedAttrs.push_back("dilation"); elidedAttrs.push_back("acc_type"); elidedAttrs.push_back("local_bound"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaConv3DOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaConv3DOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaConv3DOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaCosOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaCosOpGenericAdaptorBase::TosaCosOpGenericAdaptorBase(TosaCosOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaCosOpAdaptor::TosaCosOpAdaptor(TosaCosOp op) : TosaCosOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaCosOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaCosOp::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 TosaCosOp::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 TosaCosOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaCosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaCosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaCosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaCosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaCosOp TosaCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCosOp TosaCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaCosOp::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); } TosaCosOp TosaCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCosOp TosaCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaCosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaCosOp TosaCosOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCosOp TosaCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaCosOp::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); } TosaCosOp TosaCosOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCosOp TosaCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaCosOp::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(TosaCosOp::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)."); } } TosaCosOp TosaCosOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCosOp TosaCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaCosOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaCosOp TosaCosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCosOp TosaCosOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaCosOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaCosOp::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)."); } } TosaCosOp TosaCosOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaCosOp TosaCosOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaCosOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaCosOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaCosOp::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 TosaCosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaCosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaCosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaCosOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaDepthwiseConv2DOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaDepthwiseConv2DOpGenericAdaptorBase::TosaDepthwiseConv2DOpGenericAdaptorBase(TosaDepthwiseConv2DOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::DenseIntElementsAttr TosaDepthwiseConv2DOpGenericAdaptorBase::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaDepthwiseConv2DOpGenericAdaptorBase::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaDepthwiseConv2DOpGenericAdaptorBase::getDilation() { auto attr = getDilationAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaDepthwiseConv2DOpGenericAdaptorBase::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } bool TosaDepthwiseConv2DOpGenericAdaptorBase::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } } // namespace detail TosaDepthwiseConv2DOpAdaptor::TosaDepthwiseConv2DOpAdaptor(TosaDepthwiseConv2DOp op) : TosaDepthwiseConv2DOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaDepthwiseConv2DOpAdaptor::verify(::mlir::Location loc) { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op requires attribute 'acc_type'"); auto tblgen_dilation = getProperties().dilation; (void)tblgen_dilation; if (!tblgen_dilation) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op requires attribute 'dilation'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op requires attribute 'local_bound'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op requires attribute 'stride'"); if (tblgen_pad && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_pad))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getShape() == ::mlir::ArrayRef({4})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 0; }))))) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op attribute 'pad' failed to satisfy constraint: 32-bit signless int elements attribute of shape [4] Attr with type = spirv::TensorArmType all values must be >= 0"); if (tblgen_stride && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_stride))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op attribute 'stride' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_dilation && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilation))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilation).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilation).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_dilation).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_dilation).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op attribute 'dilation' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_acc_type && !((::llvm::isa<::mlir::spirv::TosaExtAccTypeAttr>(tblgen_acc_type)))) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op attribute 'acc_type' failed to satisfy constraint: Tosa Ext Acculumator Type"); if (tblgen_local_bound && !((::llvm::isa<::mlir::BoolAttr>(tblgen_local_bound)))) return emitError(loc, "'spirv.Tosa.DepthwiseConv2D' op attribute 'local_bound' failed to satisfy constraint: bool attribute"); return ::mlir::success(); } ::llvm::LogicalResult TosaDepthwiseConv2DOp::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.acc_type; auto attr = dict.get("acc_type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `acc_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.dilation; auto attr = dict.get("dilation"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `dilation` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.local_bound; auto attr = dict.get("local_bound"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `local_bound` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.pad; auto attr = dict.get("pad"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `pad` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.stride; auto attr = dict.get("stride"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `stride` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaDepthwiseConv2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.acc_type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("acc_type", propStorage)); } { const auto &propStorage = prop.dilation; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("dilation", propStorage)); } { const auto &propStorage = prop.local_bound; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("local_bound", propStorage)); } { const auto &propStorage = prop.pad; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("pad", propStorage)); } { const auto &propStorage = prop.stride; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("stride", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaDepthwiseConv2DOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.acc_type.getAsOpaquePointer()), llvm::hash_value(prop.dilation.getAsOpaquePointer()), llvm::hash_value(prop.local_bound.getAsOpaquePointer()), llvm::hash_value(prop.pad.getAsOpaquePointer()), llvm::hash_value(prop.stride.getAsOpaquePointer())); } std::optional TosaDepthwiseConv2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "acc_type") return prop.acc_type; if (name == "dilation") return prop.dilation; if (name == "local_bound") return prop.local_bound; if (name == "pad") return prop.pad; if (name == "stride") return prop.stride; return std::nullopt; } void TosaDepthwiseConv2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "acc_type") { prop.acc_type = ::llvm::dyn_cast_or_null>(value); return; } if (name == "dilation") { prop.dilation = ::llvm::dyn_cast_or_null>(value); return; } if (name == "local_bound") { prop.local_bound = ::llvm::dyn_cast_or_null>(value); return; } if (name == "pad") { prop.pad = ::llvm::dyn_cast_or_null>(value); return; } if (name == "stride") { prop.stride = ::llvm::dyn_cast_or_null>(value); return; } } void TosaDepthwiseConv2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.acc_type) attrs.append("acc_type", prop.acc_type); if (prop.dilation) attrs.append("dilation", prop.dilation); if (prop.local_bound) attrs.append("local_bound", prop.local_bound); if (prop.pad) attrs.append("pad", prop.pad); if (prop.stride) attrs.append("stride", prop.stride); } ::llvm::LogicalResult TosaDepthwiseConv2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAccTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(attr, "acc_type", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getDilationAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "dilation", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLocalBoundAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "local_bound", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getPadAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps40(attr, "pad", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getStrideAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "stride", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaDepthwiseConv2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.acc_type))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.dilation))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.local_bound))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.pad))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.stride))) return ::mlir::failure(); return ::mlir::success(); } void TosaDepthwiseConv2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.acc_type); writer.writeAttribute(prop.dilation); writer.writeAttribute(prop.local_bound); writer.writeAttribute(prop.pad); writer.writeAttribute(prop.stride); } ::mlir::DenseIntElementsAttr TosaDepthwiseConv2DOp::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaDepthwiseConv2DOp::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaDepthwiseConv2DOp::getDilation() { auto attr = getDilationAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaDepthwiseConv2DOp::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } bool TosaDepthwiseConv2DOp::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } void TosaDepthwiseConv2DOp::setAccType(::mlir::spirv::TosaExtAccType attrValue) { getProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaDepthwiseConv2DOp::setLocalBound(bool attrValue) { getProperties().local_bound = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaDepthwiseConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = acc_type; odsState.getOrAddProperties().local_bound = local_bound; odsState.addTypes(output); } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaDepthwiseConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = acc_type; odsState.getOrAddProperties().local_bound = local_bound; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaDepthwiseConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); odsState.addTypes(output); } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaDepthwiseConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().dilation = dilation; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr pad, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr dilation, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(pad), std::forward(stride), std::forward(dilation), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaDepthwiseConv2DOp::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(); ::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."); } } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaDepthwiseConv2DOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaDepthwiseConv2DOp TosaDepthwiseConv2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaDepthwiseConv2DOp::verifyInvariantsImpl() { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitOpError("requires attribute 'acc_type'"); auto tblgen_dilation = getProperties().dilation; (void)tblgen_dilation; if (!tblgen_dilation) return emitOpError("requires attribute 'dilation'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitOpError("requires attribute 'local_bound'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitOpError("requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitOpError("requires attribute 'stride'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps40(*this, tblgen_pad, "pad"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_stride, "stride"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_dilation, "dilation"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(*this, tblgen_acc_type, "acc_type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_local_bound, "local_bound"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps59(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps67(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps68(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps60(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup4 = getODSOperands(4); for (auto v : valueGroup4) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps69(*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_SPIRVOps70(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(2)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(2)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) * ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3) == 1))) && ((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == 1))))) return emitOpError("failed to verify that shapes of input, weight, bias, and output must satisfy [N,IH,IW,IC], [KH,KW,IC,M], [IC*M/1], [N,OH,OW,IC*M]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then output must have a type in [32-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(64)))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then output must have a type in [64-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then output must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then output must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type f8E5M2 type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then weight must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then weight must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then weight must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then weight must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then weight must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then weight must have a type in [f8E4M3FN type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type f8E5M2 type then weight must have a type in [f8E5M2 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT32] when type has value 8-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT48}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT48] when type has value 16-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16,::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16,FP32] when type has value 16-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value bfloat16 type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value 32-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E4M3FN type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E5M2 type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin())))))) return emitOpError("failed to verify that all of {bias, output} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, input_zp} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin())))))) return emitOpError("failed to verify that all of {weight, weight_zp} have same element type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaDepthwiseConv2DOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult TosaDepthwiseConv2DOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::DenseIntElementsAttr padAttr; ::mlir::DenseIntElementsAttr strideAttr; ::mlir::DenseIntElementsAttr dilationAttr; ::mlir::spirv::TosaExtAccTypeAttr acc_typeAttr; ::mlir::BoolAttr local_boundAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand weightRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> weightOperands(&weightRawOperand, 1); ::llvm::SMLoc weightOperandsLoc; (void)weightOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand biasRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> biasOperands(&biasRawOperand, 1); ::llvm::SMLoc biasOperandsLoc; (void)biasOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_zpOperands(&input_zpRawOperand, 1); ::llvm::SMLoc input_zpOperandsLoc; (void)input_zpOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand weight_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> weight_zpOperands(&weight_zpRawOperand, 1); ::llvm::SMLoc weight_zpOperandsLoc; (void)weight_zpOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("pad")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, padAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().pad = padAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("stride")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, strideAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().stride = strideAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("dilation")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, dilationAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().dilation = dilationAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("acc_type")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(acc_typeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (acc_typeAttr) result.getOrAddProperties().acc_type = acc_typeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("local_bound")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(local_boundAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (local_boundAttr) result.getOrAddProperties().local_bound = local_boundAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); weightOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(weightRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); biasOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(biasRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_zpRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); weight_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(weight_zpRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(inputOperands, weightOperands, biasOperands, input_zpOperands, weight_zpOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaDepthwiseConv2DOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "pad"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getPadAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "stride"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getStrideAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "dilation"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getDilationAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "acc_type"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getAccTypeAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "local_bound"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getLocalBoundAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getWeight(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getBias(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputZp(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getWeightZp(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("pad"); elidedAttrs.push_back("stride"); elidedAttrs.push_back("dilation"); elidedAttrs.push_back("acc_type"); elidedAttrs.push_back("local_bound"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaDepthwiseConv2DOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaDepthwiseConv2DOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaDepthwiseConv2DOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaEqualOpGenericAdaptorBase::TosaEqualOpGenericAdaptorBase(TosaEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaEqualOpAdaptor::TosaEqualOpAdaptor(TosaEqualOp op) : TosaEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaEqualOp::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 TosaEqualOp::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 TosaEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaEqualOp TosaEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaEqualOp TosaEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaEqualOp TosaEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaEqualOp TosaEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaEqualOp::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); } TosaEqualOp TosaEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaEqualOp TosaEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaEqualOp TosaEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaEqualOp TosaEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps74(*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 {input1, input2} have same element type"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaErfOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaErfOpGenericAdaptorBase::TosaErfOpGenericAdaptorBase(TosaErfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaErfOpAdaptor::TosaErfOpAdaptor(TosaErfOp op) : TosaErfOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaErfOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaErfOp::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 TosaErfOp::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 TosaErfOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaErfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaErfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaErfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaErfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input) { odsState.addOperands(input); odsState.addTypes(output); } TosaErfOp TosaErfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaErfOp TosaErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input)); } void TosaErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input) { odsState.addOperands(input); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaErfOp::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); } TosaErfOp TosaErfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaErfOp TosaErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(input)); } void TosaErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) { odsState.addOperands(input); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaErfOp TosaErfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaErfOp TosaErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input)); } void TosaErfOp::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); } TosaErfOp TosaErfOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaErfOp TosaErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaErfOp::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(TosaErfOp::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)."); } } TosaErfOp TosaErfOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaErfOp TosaErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaErfOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaErfOp TosaErfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaErfOp TosaErfOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaErfOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaErfOp::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)."); } } TosaErfOp TosaErfOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaErfOp TosaErfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaErfOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaErfOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaErfOp::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 TosaErfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaErfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaErfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaErfOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaExpOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaExpOpGenericAdaptorBase::TosaExpOpGenericAdaptorBase(TosaExpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaExpOpAdaptor::TosaExpOpAdaptor(TosaExpOp op) : TosaExpOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaExpOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaExpOp::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 TosaExpOp::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 TosaExpOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaExpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaExpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaExpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaExpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaExpOp TosaExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaExpOp TosaExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaExpOp::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); } TosaExpOp TosaExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaExpOp TosaExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaExpOp TosaExpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaExpOp TosaExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaExpOp::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); } TosaExpOp TosaExpOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaExpOp TosaExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaExpOp::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(TosaExpOp::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)."); } } TosaExpOp TosaExpOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaExpOp TosaExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaExpOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaExpOp TosaExpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaExpOp TosaExpOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaExpOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaExpOp::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)."); } } TosaExpOp TosaExpOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaExpOp TosaExpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaExpOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaExpOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaExpOp::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 TosaExpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaExpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaExpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaExpOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaFFT2DOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaFFT2DOpGenericAdaptorBase::TosaFFT2DOpGenericAdaptorBase(TosaFFT2DOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} bool TosaFFT2DOpGenericAdaptorBase::getInverse() { auto attr = getInverseAttr(); return attr.getValue(); } bool TosaFFT2DOpGenericAdaptorBase::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } } // namespace detail TosaFFT2DOpAdaptor::TosaFFT2DOpAdaptor(TosaFFT2DOp op) : TosaFFT2DOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaFFT2DOpAdaptor::verify(::mlir::Location loc) { auto tblgen_inverse = getProperties().inverse; (void)tblgen_inverse; if (!tblgen_inverse) return emitError(loc, "'spirv.Tosa.FFT2D' op requires attribute 'inverse'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitError(loc, "'spirv.Tosa.FFT2D' op requires attribute 'local_bound'"); if (tblgen_inverse && !((::llvm::isa<::mlir::BoolAttr>(tblgen_inverse)))) return emitError(loc, "'spirv.Tosa.FFT2D' op attribute 'inverse' failed to satisfy constraint: bool attribute"); if (tblgen_local_bound && !((::llvm::isa<::mlir::BoolAttr>(tblgen_local_bound)))) return emitError(loc, "'spirv.Tosa.FFT2D' op attribute 'local_bound' failed to satisfy constraint: bool attribute"); return ::mlir::success(); } ::llvm::LogicalResult TosaFFT2DOp::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.inverse; auto attr = dict.get("inverse"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `inverse` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.local_bound; auto attr = dict.get("local_bound"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `local_bound` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaFFT2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.inverse; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("inverse", propStorage)); } { const auto &propStorage = prop.local_bound; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("local_bound", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaFFT2DOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.inverse.getAsOpaquePointer()), llvm::hash_value(prop.local_bound.getAsOpaquePointer())); } std::optional TosaFFT2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "inverse") return prop.inverse; if (name == "local_bound") return prop.local_bound; return std::nullopt; } void TosaFFT2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "inverse") { prop.inverse = ::llvm::dyn_cast_or_null>(value); return; } if (name == "local_bound") { prop.local_bound = ::llvm::dyn_cast_or_null>(value); return; } } void TosaFFT2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.inverse) attrs.append("inverse", prop.inverse); if (prop.local_bound) attrs.append("local_bound", prop.local_bound); } ::llvm::LogicalResult TosaFFT2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getInverseAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "inverse", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLocalBoundAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "local_bound", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaFFT2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.inverse))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.local_bound))) return ::mlir::failure(); return ::mlir::success(); } void TosaFFT2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.inverse); writer.writeAttribute(prop.local_bound); } bool TosaFFT2DOp::getInverse() { auto attr = getInverseAttr(); return attr.getValue(); } bool TosaFFT2DOp::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } void TosaFFT2DOp::setInverse(bool attrValue) { getProperties().inverse = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaFFT2DOp::setLocalBound(bool attrValue) { getProperties().local_bound = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaFFT2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::BoolAttr inverse, ::mlir::BoolAttr local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { odsState.addOperands(input_real); odsState.addOperands(input_imag); odsState.getOrAddProperties().inverse = inverse; odsState.getOrAddProperties().local_bound = local_bound; odsState.addTypes(output); } TosaFFT2DOp TosaFFT2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::BoolAttr inverse, ::mlir::BoolAttr local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(inverse), std::forward(local_bound), std::forward(input_real), std::forward(input_imag)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFFT2DOp TosaFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::BoolAttr inverse, ::mlir::BoolAttr local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { return create(builder, builder.getLoc(), std::forward(output), std::forward(inverse), std::forward(local_bound), std::forward(input_real), std::forward(input_imag)); } void TosaFFT2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr inverse, ::mlir::BoolAttr local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { odsState.addOperands(input_real); odsState.addOperands(input_imag); odsState.getOrAddProperties().inverse = inverse; odsState.getOrAddProperties().local_bound = local_bound; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaFFT2DOp TosaFFT2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr inverse, ::mlir::BoolAttr local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(inverse), std::forward(local_bound), std::forward(input_real), std::forward(input_imag)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFFT2DOp TosaFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr inverse, ::mlir::BoolAttr local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(inverse), std::forward(local_bound), std::forward(input_real), std::forward(input_imag)); } void TosaFFT2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, bool inverse, bool local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { odsState.addOperands(input_real); odsState.addOperands(input_imag); odsState.getOrAddProperties().inverse = odsBuilder.getBoolAttr(inverse); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); odsState.addTypes(output); } TosaFFT2DOp TosaFFT2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, bool inverse, bool local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(inverse), std::forward(local_bound), std::forward(input_real), std::forward(input_imag)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFFT2DOp TosaFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, bool inverse, bool local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { return create(builder, builder.getLoc(), std::forward(output), std::forward(inverse), std::forward(local_bound), std::forward(input_real), std::forward(input_imag)); } void TosaFFT2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, bool inverse, bool local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { odsState.addOperands(input_real); odsState.addOperands(input_imag); odsState.getOrAddProperties().inverse = odsBuilder.getBoolAttr(inverse); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaFFT2DOp TosaFFT2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, bool inverse, bool local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(inverse), std::forward(local_bound), std::forward(input_real), std::forward(input_imag)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFFT2DOp TosaFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, bool inverse, bool local_bound, ::mlir::Value input_real, ::mlir::Value input_imag) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(inverse), std::forward(local_bound), std::forward(input_real), std::forward(input_imag)); } void TosaFFT2DOp::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(); ::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."); } } TosaFFT2DOp TosaFFT2DOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFFT2DOp TosaFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaFFT2DOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaFFT2DOp TosaFFT2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFFT2DOp TosaFFT2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaFFT2DOp::verifyInvariantsImpl() { auto tblgen_inverse = getProperties().inverse; (void)tblgen_inverse; if (!tblgen_inverse) return emitOpError("requires attribute 'inverse'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitOpError("requires attribute 'local_bound'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_inverse, "inverse"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_local_bound, "local_bound"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps75(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps75(*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_SPIRVOps76(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape())))) return emitOpError("failed to verify that all of {input_real, input_imag} have same shape"); if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(getResultRealType().getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(getResultImagType().getDimSize(0)))) || (((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == getResultRealType().getDimSize(0))) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == getResultImagType().getDimSize(0))))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(getResultRealType().getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(getResultImagType().getDimSize(1)))) || (((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == getResultRealType().getDimSize(1))) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == getResultImagType().getDimSize(1))))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(getResultRealType().getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(getResultImagType().getDimSize(2)))) || (((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == getResultRealType().getDimSize(2))) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == getResultImagType().getDimSize(2))))))) return emitOpError("failed to verify that shapes of output_real and output_imag must match the shape of input_real"); if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((llvm::isPowerOf2_64(static_cast(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((llvm::isPowerOf2_64(static_cast(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))))))) return emitOpError("failed to verify that dimensions 1, 2 of input_real must be powers of two"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaFFT2DOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaFFT2DOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::BoolAttr inverseAttr; ::mlir::BoolAttr local_boundAttr; ::mlir::OpAsmParser::UnresolvedOperand input_realRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_realOperands(&input_realRawOperand, 1); ::llvm::SMLoc input_realOperandsLoc; (void)input_realOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input_imagRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_imagOperands(&input_imagRawOperand, 1); ::llvm::SMLoc input_imagOperandsLoc; (void)input_imagOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("inverse")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(inverseAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (inverseAttr) result.getOrAddProperties().inverse = inverseAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("local_bound")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(local_boundAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (local_boundAttr) result.getOrAddProperties().local_bound = local_boundAttr; if (parser.parseComma()) return ::mlir::failure(); input_realOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_realRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input_imagOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_imagRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input_realOperands, input_imagOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaFFT2DOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "inverse"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getInverseAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "local_bound"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getLocalBoundAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputReal(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputImag(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("inverse"); elidedAttrs.push_back("local_bound"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaFFT2DOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaFFT2DOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaFFT2DOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaFloorOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaFloorOpGenericAdaptorBase::TosaFloorOpGenericAdaptorBase(TosaFloorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaFloorOpAdaptor::TosaFloorOpAdaptor(TosaFloorOp op) : TosaFloorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaFloorOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaFloorOp::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 TosaFloorOp::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 TosaFloorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaFloorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaFloorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaFloorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaFloorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaFloorOp TosaFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFloorOp TosaFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaFloorOp::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); } TosaFloorOp TosaFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFloorOp TosaFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaFloorOp TosaFloorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFloorOp TosaFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaFloorOp::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); } TosaFloorOp TosaFloorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFloorOp TosaFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaFloorOp::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(TosaFloorOp::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)."); } } TosaFloorOp TosaFloorOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFloorOp TosaFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaFloorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaFloorOp TosaFloorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFloorOp TosaFloorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaFloorOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaFloorOp::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)."); } } TosaFloorOp TosaFloorOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaFloorOp TosaFloorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaFloorOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaFloorOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaFloorOp::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 TosaFloorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaFloorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaFloorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaFloorOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaGatherOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaGatherOpGenericAdaptorBase::TosaGatherOpGenericAdaptorBase(TosaGatherOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaGatherOpAdaptor::TosaGatherOpAdaptor(TosaGatherOp op) : TosaGatherOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaGatherOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaGatherOp::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 TosaGatherOp::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 TosaGatherOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaGatherOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaGatherOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaGatherOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaGatherOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices) { odsState.addOperands(values); odsState.addOperands(indices); odsState.addTypes(output); } TosaGatherOp TosaGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(values), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGatherOp TosaGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices) { return create(builder, builder.getLoc(), std::forward(output), std::forward(values), std::forward(indices)); } void TosaGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices) { odsState.addOperands(values); odsState.addOperands(indices); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaGatherOp TosaGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(values), std::forward(indices)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGatherOp TosaGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(values), std::forward(indices)); } void TosaGatherOp::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); } TosaGatherOp TosaGatherOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGatherOp TosaGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaGatherOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaGatherOp TosaGatherOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGatherOp TosaGatherOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaGatherOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps77(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps78(*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_SPIRVOps77(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {values, output} have same element type"); if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))))) return emitOpError("failed to verify that shapes of values, indices, and output must satisfy [N,K,C], [N,W], [N,W,C]"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaGatherOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaGatherOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand valuesRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valuesOperands(&valuesRawOperand, 1); ::llvm::SMLoc valuesOperandsLoc; (void)valuesOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand indicesRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> indicesOperands(&indicesRawOperand, 1); ::llvm::SMLoc indicesOperandsLoc; (void)indicesOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; valuesOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(valuesRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); indicesOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(indicesRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(valuesOperands, indicesOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaGatherOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getValues(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getIndices(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaGatherOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaGatherOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaGreaterEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaGreaterEqualOpGenericAdaptorBase::TosaGreaterEqualOpGenericAdaptorBase(TosaGreaterEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaGreaterEqualOpAdaptor::TosaGreaterEqualOpAdaptor(TosaGreaterEqualOp op) : TosaGreaterEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaGreaterEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaGreaterEqualOp::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 TosaGreaterEqualOp::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 TosaGreaterEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaGreaterEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaGreaterEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaGreaterEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaGreaterEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaGreaterEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaGreaterEqualOp TosaGreaterEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGreaterEqualOp TosaGreaterEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaGreaterEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaGreaterEqualOp TosaGreaterEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGreaterEqualOp TosaGreaterEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaGreaterEqualOp::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); } TosaGreaterEqualOp TosaGreaterEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGreaterEqualOp TosaGreaterEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaGreaterEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaGreaterEqualOp TosaGreaterEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGreaterEqualOp TosaGreaterEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaGreaterEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps74(*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 {input1, input2} have same element type"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaGreaterEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaGreaterEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaGreaterEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaGreaterEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaGreaterEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaGreaterOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaGreaterOpGenericAdaptorBase::TosaGreaterOpGenericAdaptorBase(TosaGreaterOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaGreaterOpAdaptor::TosaGreaterOpAdaptor(TosaGreaterOp op) : TosaGreaterOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaGreaterOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaGreaterOp::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 TosaGreaterOp::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 TosaGreaterOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaGreaterOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaGreaterOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaGreaterOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaGreaterOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaGreaterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaGreaterOp TosaGreaterOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGreaterOp TosaGreaterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaGreaterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaGreaterOp TosaGreaterOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGreaterOp TosaGreaterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaGreaterOp::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); } TosaGreaterOp TosaGreaterOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGreaterOp TosaGreaterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaGreaterOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaGreaterOp TosaGreaterOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaGreaterOp TosaGreaterOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaGreaterOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps74(*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 {input1, input2} have same element type"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaGreaterOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaGreaterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaGreaterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaGreaterOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaGreaterOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaIntDivOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaIntDivOpGenericAdaptorBase::TosaIntDivOpGenericAdaptorBase(TosaIntDivOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaIntDivOpAdaptor::TosaIntDivOpAdaptor(TosaIntDivOp op) : TosaIntDivOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaIntDivOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaIntDivOp::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 TosaIntDivOp::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 TosaIntDivOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaIntDivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaIntDivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaIntDivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaIntDivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaIntDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaIntDivOp TosaIntDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaIntDivOp TosaIntDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaIntDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaIntDivOp TosaIntDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaIntDivOp TosaIntDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaIntDivOp::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); } TosaIntDivOp TosaIntDivOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaIntDivOp TosaIntDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaIntDivOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaIntDivOp TosaIntDivOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaIntDivOp TosaIntDivOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaIntDivOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps65(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps65(*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_SPIRVOps65(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaIntDivOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaIntDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaIntDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaIntDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaIntDivOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaLogOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaLogOpGenericAdaptorBase::TosaLogOpGenericAdaptorBase(TosaLogOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaLogOpAdaptor::TosaLogOpAdaptor(TosaLogOp op) : TosaLogOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaLogOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaLogOp::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 TosaLogOp::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 TosaLogOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaLogOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaLogOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaLogOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaLogOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaLogOp TosaLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogOp TosaLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaLogOp::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); } TosaLogOp TosaLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogOp TosaLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaLogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaLogOp TosaLogOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogOp TosaLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaLogOp::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); } TosaLogOp TosaLogOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogOp TosaLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaLogOp::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(TosaLogOp::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)."); } } TosaLogOp TosaLogOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogOp TosaLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaLogOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaLogOp TosaLogOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogOp TosaLogOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaLogOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaLogOp::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)."); } } TosaLogOp TosaLogOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogOp TosaLogOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaLogOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaLogOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaLogOp::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 TosaLogOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaLogOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaLogOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaLogOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaLogicalAndOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaLogicalAndOpGenericAdaptorBase::TosaLogicalAndOpGenericAdaptorBase(TosaLogicalAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaLogicalAndOpAdaptor::TosaLogicalAndOpAdaptor(TosaLogicalAndOp op) : TosaLogicalAndOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaLogicalAndOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalAndOp::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 TosaLogicalAndOp::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 TosaLogicalAndOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaLogicalAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaLogicalAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaLogicalAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaLogicalAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaLogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaLogicalAndOp TosaLogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalAndOp TosaLogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaLogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaLogicalAndOp TosaLogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalAndOp TosaLogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaLogicalAndOp::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); } TosaLogicalAndOp TosaLogicalAndOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalAndOp TosaLogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaLogicalAndOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaLogicalAndOp TosaLogicalAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalAndOp TosaLogicalAndOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaLogicalAndOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*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_SPIRVOps74(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalAndOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaLogicalAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaLogicalAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaLogicalAndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaLogicalAndOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaLogicalLeftShiftOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaLogicalLeftShiftOpGenericAdaptorBase::TosaLogicalLeftShiftOpGenericAdaptorBase(TosaLogicalLeftShiftOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaLogicalLeftShiftOpAdaptor::TosaLogicalLeftShiftOpAdaptor(TosaLogicalLeftShiftOp op) : TosaLogicalLeftShiftOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaLogicalLeftShiftOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalLeftShiftOp::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 TosaLogicalLeftShiftOp::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 TosaLogicalLeftShiftOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaLogicalLeftShiftOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaLogicalLeftShiftOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaLogicalLeftShiftOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaLogicalLeftShiftOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaLogicalLeftShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaLogicalLeftShiftOp TosaLogicalLeftShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalLeftShiftOp TosaLogicalLeftShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaLogicalLeftShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaLogicalLeftShiftOp TosaLogicalLeftShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalLeftShiftOp TosaLogicalLeftShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaLogicalLeftShiftOp::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); } TosaLogicalLeftShiftOp TosaLogicalLeftShiftOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalLeftShiftOp TosaLogicalLeftShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaLogicalLeftShiftOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaLogicalLeftShiftOp TosaLogicalLeftShiftOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalLeftShiftOp TosaLogicalLeftShiftOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaLogicalLeftShiftOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*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_SPIRVOps58(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalLeftShiftOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaLogicalLeftShiftOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaLogicalLeftShiftOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaLogicalLeftShiftOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaLogicalLeftShiftOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaLogicalNotOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaLogicalNotOpGenericAdaptorBase::TosaLogicalNotOpGenericAdaptorBase(TosaLogicalNotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaLogicalNotOpAdaptor::TosaLogicalNotOpAdaptor(TosaLogicalNotOp op) : TosaLogicalNotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaLogicalNotOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalNotOp::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 TosaLogicalNotOp::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 TosaLogicalNotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaLogicalNotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaLogicalNotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaLogicalNotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaLogicalNotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaLogicalNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaLogicalNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaLogicalNotOp::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); } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaLogicalNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaLogicalNotOp::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); } TosaLogicalNotOp TosaLogicalNotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaLogicalNotOp::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(TosaLogicalNotOp::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)."); } } TosaLogicalNotOp TosaLogicalNotOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaLogicalNotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaLogicalNotOp TosaLogicalNotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalNotOp TosaLogicalNotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaLogicalNotOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaLogicalNotOp::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)."); } } TosaLogicalNotOp TosaLogicalNotOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalNotOp TosaLogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaLogicalNotOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*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_SPIRVOps74(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalNotOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaLogicalNotOp::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 TosaLogicalNotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaLogicalNotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaLogicalNotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaLogicalNotOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaLogicalOrOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaLogicalOrOpGenericAdaptorBase::TosaLogicalOrOpGenericAdaptorBase(TosaLogicalOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaLogicalOrOpAdaptor::TosaLogicalOrOpAdaptor(TosaLogicalOrOp op) : TosaLogicalOrOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaLogicalOrOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalOrOp::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 TosaLogicalOrOp::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 TosaLogicalOrOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaLogicalOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaLogicalOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaLogicalOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaLogicalOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaLogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaLogicalOrOp TosaLogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalOrOp TosaLogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaLogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaLogicalOrOp TosaLogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalOrOp TosaLogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaLogicalOrOp::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); } TosaLogicalOrOp TosaLogicalOrOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalOrOp TosaLogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaLogicalOrOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaLogicalOrOp TosaLogicalOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalOrOp TosaLogicalOrOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaLogicalOrOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*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_SPIRVOps74(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalOrOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaLogicalOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaLogicalOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaLogicalOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaLogicalOrOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaLogicalRightShiftOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaLogicalRightShiftOpGenericAdaptorBase::TosaLogicalRightShiftOpGenericAdaptorBase(TosaLogicalRightShiftOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaLogicalRightShiftOpAdaptor::TosaLogicalRightShiftOpAdaptor(TosaLogicalRightShiftOp op) : TosaLogicalRightShiftOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaLogicalRightShiftOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalRightShiftOp::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 TosaLogicalRightShiftOp::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 TosaLogicalRightShiftOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaLogicalRightShiftOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaLogicalRightShiftOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaLogicalRightShiftOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaLogicalRightShiftOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaLogicalRightShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaLogicalRightShiftOp TosaLogicalRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalRightShiftOp TosaLogicalRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaLogicalRightShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaLogicalRightShiftOp TosaLogicalRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalRightShiftOp TosaLogicalRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaLogicalRightShiftOp::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); } TosaLogicalRightShiftOp TosaLogicalRightShiftOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalRightShiftOp TosaLogicalRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaLogicalRightShiftOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaLogicalRightShiftOp TosaLogicalRightShiftOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalRightShiftOp TosaLogicalRightShiftOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaLogicalRightShiftOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps58(*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_SPIRVOps58(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalRightShiftOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaLogicalRightShiftOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaLogicalRightShiftOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaLogicalRightShiftOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaLogicalRightShiftOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaLogicalXorOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaLogicalXorOpGenericAdaptorBase::TosaLogicalXorOpGenericAdaptorBase(TosaLogicalXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaLogicalXorOpAdaptor::TosaLogicalXorOpAdaptor(TosaLogicalXorOp op) : TosaLogicalXorOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaLogicalXorOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalXorOp::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 TosaLogicalXorOp::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 TosaLogicalXorOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaLogicalXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaLogicalXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaLogicalXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaLogicalXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaLogicalXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaLogicalXorOp TosaLogicalXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalXorOp TosaLogicalXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaLogicalXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaLogicalXorOp TosaLogicalXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalXorOp TosaLogicalXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaLogicalXorOp::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); } TosaLogicalXorOp TosaLogicalXorOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalXorOp TosaLogicalXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaLogicalXorOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaLogicalXorOp TosaLogicalXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaLogicalXorOp TosaLogicalXorOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaLogicalXorOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*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_SPIRVOps74(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaLogicalXorOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaLogicalXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaLogicalXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaLogicalXorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaLogicalXorOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaMatMulOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaMatMulOpGenericAdaptorBase::TosaMatMulOpGenericAdaptorBase(TosaMatMulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaMatMulOpAdaptor::TosaMatMulOpAdaptor(TosaMatMulOp op) : TosaMatMulOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaMatMulOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaMatMulOp::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 TosaMatMulOp::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 TosaMatMulOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaMatMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaMatMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaMatMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaMatMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaMatMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value A, ::mlir::Value B, ::mlir::Value A_zp, ::mlir::Value B_zp) { odsState.addOperands(A); odsState.addOperands(B); odsState.addOperands(A_zp); odsState.addOperands(B_zp); odsState.addTypes(output); } TosaMatMulOp TosaMatMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value A, ::mlir::Value B, ::mlir::Value A_zp, ::mlir::Value B_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(A), std::forward(B), std::forward(A_zp), std::forward(B_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMatMulOp TosaMatMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value A, ::mlir::Value B, ::mlir::Value A_zp, ::mlir::Value B_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(A), std::forward(B), std::forward(A_zp), std::forward(B_zp)); } void TosaMatMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value A, ::mlir::Value B, ::mlir::Value A_zp, ::mlir::Value B_zp) { odsState.addOperands(A); odsState.addOperands(B); odsState.addOperands(A_zp); odsState.addOperands(B_zp); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaMatMulOp TosaMatMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value A, ::mlir::Value B, ::mlir::Value A_zp, ::mlir::Value B_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(A), std::forward(B), std::forward(A_zp), std::forward(B_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMatMulOp TosaMatMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value A, ::mlir::Value B, ::mlir::Value A_zp, ::mlir::Value B_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(A), std::forward(B), std::forward(A_zp), std::forward(B_zp)); } void TosaMatMulOp::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); } TosaMatMulOp TosaMatMulOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMatMulOp TosaMatMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaMatMulOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaMatMulOp TosaMatMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMatMulOp TosaMatMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaMatMulOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps79(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps79(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps60(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps60(*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_SPIRVOps80(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(1)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(1)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))))) return emitOpError("failed to verify that shapes of A, B, and output must satisfy [N,H,C], [N,C,W], [N,H,W]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))))) return emitOpError("failed to verify that if A has type 8-bit signless integer then output must have a type in [32-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(64)))))) return emitOpError("failed to verify that if A has type 16-bit signless integer then output must have a type in [64-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))))) return emitOpError("failed to verify that if A has type bfloat16 type then output must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32())))))) return emitOpError("failed to verify that if A has type 16-bit float then output must have a type in [16-bit float,32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))))) return emitOpError("failed to verify that if A has type 32-bit float then output must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if A has type f8E4M3FN type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if A has type f8E5M2 type then output must have a type in [16-bit float]"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {A, A_zp, B, B_zp} have same element type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaMatMulOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaMatMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand ARawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> AOperands(&ARawOperand, 1); ::llvm::SMLoc AOperandsLoc; (void)AOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand BRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> BOperands(&BRawOperand, 1); ::llvm::SMLoc BOperandsLoc; (void)BOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand A_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> A_zpOperands(&A_zpRawOperand, 1); ::llvm::SMLoc A_zpOperandsLoc; (void)A_zpOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand B_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> B_zpOperands(&B_zpRawOperand, 1); ::llvm::SMLoc B_zpOperandsLoc; (void)B_zpOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; AOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(ARawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); BOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(BRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); A_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(A_zpRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); B_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(B_zpRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(AOperands, BOperands, A_zpOperands, B_zpOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaMatMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getA(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getB(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getAZp(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getBZp(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaMatMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaMatMulOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaMaxPool2DOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaMaxPool2DOpGenericAdaptorBase::TosaMaxPool2DOpGenericAdaptorBase(TosaMaxPool2DOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::DenseIntElementsAttr TosaMaxPool2DOpGenericAdaptorBase::getKernel() { auto attr = getKernelAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaMaxPool2DOpGenericAdaptorBase::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaMaxPool2DOpGenericAdaptorBase::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::spirv::TosaExtNaNPropagationModeType TosaMaxPool2DOpGenericAdaptorBase::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } } // namespace detail TosaMaxPool2DOpAdaptor::TosaMaxPool2DOpAdaptor(TosaMaxPool2DOp op) : TosaMaxPool2DOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaMaxPool2DOpAdaptor::verify(::mlir::Location loc) { auto tblgen_kernel = getProperties().kernel; (void)tblgen_kernel; if (!tblgen_kernel) return emitError(loc, "'spirv.Tosa.MaxPool2D' op requires attribute 'kernel'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitError(loc, "'spirv.Tosa.MaxPool2D' op requires attribute 'nan_mode'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitError(loc, "'spirv.Tosa.MaxPool2D' op requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitError(loc, "'spirv.Tosa.MaxPool2D' op requires attribute 'stride'"); if (tblgen_kernel && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_kernel))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_kernel).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_kernel).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_kernel).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_kernel).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.MaxPool2D' op attribute 'kernel' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_stride && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_stride))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.MaxPool2D' op attribute 'stride' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_pad && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_pad))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_pad).getType().getShape() == ::mlir::ArrayRef({4})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_pad).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 0; }))))) return emitError(loc, "'spirv.Tosa.MaxPool2D' op attribute 'pad' failed to satisfy constraint: 32-bit signless int elements attribute of shape [4] Attr with type = spirv::TensorArmType all values must be >= 0"); if (tblgen_nan_mode && !((::llvm::isa<::mlir::spirv::TosaExtNaNPropagationModeTypeAttr>(tblgen_nan_mode)))) return emitError(loc, "'spirv.Tosa.MaxPool2D' op attribute 'nan_mode' failed to satisfy constraint: Tosa Ext NaN Propoagation Mode Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaMaxPool2DOp::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.kernel; auto attr = dict.get("kernel"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `kernel` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.nan_mode; auto attr = dict.get("nan_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `nan_mode` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.pad; auto attr = dict.get("pad"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `pad` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.stride; auto attr = dict.get("stride"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `stride` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaMaxPool2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.kernel; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("kernel", propStorage)); } { const auto &propStorage = prop.nan_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("nan_mode", propStorage)); } { const auto &propStorage = prop.pad; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("pad", propStorage)); } { const auto &propStorage = prop.stride; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("stride", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaMaxPool2DOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.kernel.getAsOpaquePointer()), llvm::hash_value(prop.nan_mode.getAsOpaquePointer()), llvm::hash_value(prop.pad.getAsOpaquePointer()), llvm::hash_value(prop.stride.getAsOpaquePointer())); } std::optional TosaMaxPool2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "kernel") return prop.kernel; if (name == "nan_mode") return prop.nan_mode; if (name == "pad") return prop.pad; if (name == "stride") return prop.stride; return std::nullopt; } void TosaMaxPool2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "kernel") { prop.kernel = ::llvm::dyn_cast_or_null>(value); return; } if (name == "nan_mode") { prop.nan_mode = ::llvm::dyn_cast_or_null>(value); return; } if (name == "pad") { prop.pad = ::llvm::dyn_cast_or_null>(value); return; } if (name == "stride") { prop.stride = ::llvm::dyn_cast_or_null>(value); return; } } void TosaMaxPool2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.kernel) attrs.append("kernel", prop.kernel); if (prop.nan_mode) attrs.append("nan_mode", prop.nan_mode); if (prop.pad) attrs.append("pad", prop.pad); if (prop.stride) attrs.append("stride", prop.stride); } ::llvm::LogicalResult TosaMaxPool2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getKernelAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "kernel", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getNanModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(attr, "nan_mode", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getPadAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps40(attr, "pad", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getStrideAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "stride", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaMaxPool2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.kernel))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.nan_mode))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.pad))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.stride))) return ::mlir::failure(); return ::mlir::success(); } void TosaMaxPool2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.kernel); writer.writeAttribute(prop.nan_mode); writer.writeAttribute(prop.pad); writer.writeAttribute(prop.stride); } ::mlir::DenseIntElementsAttr TosaMaxPool2DOp::getKernel() { auto attr = getKernelAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaMaxPool2DOp::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaMaxPool2DOp::getPad() { auto attr = getPadAttr(); return attr; } ::mlir::spirv::TosaExtNaNPropagationModeType TosaMaxPool2DOp::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } void TosaMaxPool2DOp::setNanMode(::mlir::spirv::TosaExtNaNPropagationModeType attrValue) { getProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaMaxPool2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().kernel = kernel; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().nan_mode = nan_mode; odsState.addTypes(output); } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(nan_mode), std::forward(input)); } void TosaMaxPool2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().kernel = kernel; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().nan_mode = nan_mode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(nan_mode), std::forward(input)); } void TosaMaxPool2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().kernel = kernel; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); odsState.addTypes(output); } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(nan_mode), std::forward(input)); } void TosaMaxPool2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().kernel = kernel; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().pad = pad; odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr kernel, ::mlir::DenseIntElementsAttr stride, ::mlir::DenseIntElementsAttr pad, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(kernel), std::forward(stride), std::forward(pad), std::forward(nan_mode), std::forward(input)); } void TosaMaxPool2DOp::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(); ::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."); } } TosaMaxPool2DOp TosaMaxPool2DOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaxPool2DOp TosaMaxPool2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaMaxPool2DOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaMaxPool2DOp TosaMaxPool2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaxPool2DOp TosaMaxPool2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaMaxPool2DOp::verifyInvariantsImpl() { auto tblgen_kernel = getProperties().kernel; (void)tblgen_kernel; if (!tblgen_kernel) return emitOpError("requires attribute 'kernel'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitOpError("requires attribute 'nan_mode'"); auto tblgen_pad = getProperties().pad; (void)tblgen_pad; if (!tblgen_pad) return emitOpError("requires attribute 'pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitOpError("requires attribute 'stride'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_kernel, "kernel"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_stride, "stride"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps40(*this, tblgen_pad, "pad"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(*this, tblgen_nan_mode, "nan_mode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps59(*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_SPIRVOps59(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, output} have same element type"); if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) return emitOpError("failed to verify that shapes of input and output must satisfy [N,*,*,C] and [N,*,*,C]"); if (!(((getPad().getValues()[0].getSExtValue() < getKernel().getValues()[0].getSExtValue())) && ((getPad().getValues()[1].getSExtValue() < getKernel().getValues()[0].getSExtValue())) && ((getPad().getValues()[2].getSExtValue() < getKernel().getValues()[1].getSExtValue())) && ((getPad().getValues()[3].getSExtValue() < getKernel().getValues()[1].getSExtValue())))) return emitOpError("failed to verify that op pad values must satisfy pad_top/pad_bottom < kernel_y and pad_left/pad_right < kernel_x"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaMaxPool2DOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult TosaMaxPool2DOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::DenseIntElementsAttr kernelAttr; ::mlir::DenseIntElementsAttr strideAttr; ::mlir::DenseIntElementsAttr padAttr; ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_modeAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("kernel")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, kernelAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().kernel = kernelAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("stride")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, strideAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().stride = strideAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("pad")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, padAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().pad = padAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("nan_mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(nan_modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (nan_modeAttr) result.getOrAddProperties().nan_mode = nan_modeAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaMaxPool2DOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "kernel"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getKernelAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "stride"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getStrideAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "pad"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getPadAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "nan_mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getNanModeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("kernel"); elidedAttrs.push_back("stride"); elidedAttrs.push_back("pad"); elidedAttrs.push_back("nan_mode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaMaxPool2DOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaMaxPool2DOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaMaxPool2DOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaMaximumOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaMaximumOpGenericAdaptorBase::TosaMaximumOpGenericAdaptorBase(TosaMaximumOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::TosaExtNaNPropagationModeType TosaMaximumOpGenericAdaptorBase::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } } // namespace detail TosaMaximumOpAdaptor::TosaMaximumOpAdaptor(TosaMaximumOp op) : TosaMaximumOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaMaximumOpAdaptor::verify(::mlir::Location loc) { auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitError(loc, "'spirv.Tosa.Maximum' op requires attribute 'nan_mode'"); if (tblgen_nan_mode && !((::llvm::isa<::mlir::spirv::TosaExtNaNPropagationModeTypeAttr>(tblgen_nan_mode)))) return emitError(loc, "'spirv.Tosa.Maximum' op attribute 'nan_mode' failed to satisfy constraint: Tosa Ext NaN Propoagation Mode Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaMaximumOp::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.nan_mode; auto attr = dict.get("nan_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `nan_mode` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaMaximumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.nan_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("nan_mode", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaMaximumOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.nan_mode.getAsOpaquePointer())); } std::optional TosaMaximumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "nan_mode") return prop.nan_mode; return std::nullopt; } void TosaMaximumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "nan_mode") { prop.nan_mode = ::llvm::dyn_cast_or_null>(value); return; } } void TosaMaximumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.nan_mode) attrs.append("nan_mode", prop.nan_mode); } ::llvm::LogicalResult TosaMaximumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getNanModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(attr, "nan_mode", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaMaximumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.nan_mode))) return ::mlir::failure(); return ::mlir::success(); } void TosaMaximumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.nan_mode); } ::mlir::spirv::TosaExtNaNPropagationModeType TosaMaximumOp::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } void TosaMaximumOp::setNanMode(::mlir::spirv::TosaExtNaNPropagationModeType attrValue) { getProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaMaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().nan_mode = nan_mode; odsState.addTypes(output); } TosaMaximumOp TosaMaximumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(nan_mode), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaximumOp TosaMaximumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(nan_mode), std::forward(input1), std::forward(input2)); } void TosaMaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().nan_mode = nan_mode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaMaximumOp TosaMaximumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(nan_mode), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaximumOp TosaMaximumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(nan_mode), std::forward(input1), std::forward(input2)); } void TosaMaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); odsState.addTypes(output); } TosaMaximumOp TosaMaximumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(nan_mode), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaximumOp TosaMaximumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(nan_mode), std::forward(input1), std::forward(input2)); } void TosaMaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaMaximumOp TosaMaximumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(nan_mode), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaximumOp TosaMaximumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(nan_mode), std::forward(input1), std::forward(input2)); } void TosaMaximumOp::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(); ::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."); } } TosaMaximumOp TosaMaximumOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaximumOp TosaMaximumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaMaximumOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaMaximumOp TosaMaximumOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMaximumOp TosaMaximumOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaMaximumOp::verifyInvariantsImpl() { auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitOpError("requires attribute 'nan_mode'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(*this, tblgen_nan_mode, "nan_mode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps55(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaMaximumOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaMaximumOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_modeAttr; ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("nan_mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(nan_modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (nan_modeAttr) result.getOrAddProperties().nan_mode = nan_modeAttr; if (parser.parseComma()) return ::mlir::failure(); input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaMaximumOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "nan_mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getNanModeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("nan_mode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaMaximumOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaMaximumOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaMaximumOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaMinimumOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaMinimumOpGenericAdaptorBase::TosaMinimumOpGenericAdaptorBase(TosaMinimumOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::TosaExtNaNPropagationModeType TosaMinimumOpGenericAdaptorBase::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } } // namespace detail TosaMinimumOpAdaptor::TosaMinimumOpAdaptor(TosaMinimumOp op) : TosaMinimumOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaMinimumOpAdaptor::verify(::mlir::Location loc) { auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitError(loc, "'spirv.Tosa.Minimum' op requires attribute 'nan_mode'"); if (tblgen_nan_mode && !((::llvm::isa<::mlir::spirv::TosaExtNaNPropagationModeTypeAttr>(tblgen_nan_mode)))) return emitError(loc, "'spirv.Tosa.Minimum' op attribute 'nan_mode' failed to satisfy constraint: Tosa Ext NaN Propoagation Mode Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaMinimumOp::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.nan_mode; auto attr = dict.get("nan_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `nan_mode` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaMinimumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.nan_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("nan_mode", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaMinimumOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.nan_mode.getAsOpaquePointer())); } std::optional TosaMinimumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "nan_mode") return prop.nan_mode; return std::nullopt; } void TosaMinimumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "nan_mode") { prop.nan_mode = ::llvm::dyn_cast_or_null>(value); return; } } void TosaMinimumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.nan_mode) attrs.append("nan_mode", prop.nan_mode); } ::llvm::LogicalResult TosaMinimumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getNanModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(attr, "nan_mode", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaMinimumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.nan_mode))) return ::mlir::failure(); return ::mlir::success(); } void TosaMinimumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.nan_mode); } ::mlir::spirv::TosaExtNaNPropagationModeType TosaMinimumOp::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } void TosaMinimumOp::setNanMode(::mlir::spirv::TosaExtNaNPropagationModeType attrValue) { getProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaMinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().nan_mode = nan_mode; odsState.addTypes(output); } TosaMinimumOp TosaMinimumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(nan_mode), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMinimumOp TosaMinimumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(nan_mode), std::forward(input1), std::forward(input2)); } void TosaMinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().nan_mode = nan_mode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaMinimumOp TosaMinimumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(nan_mode), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMinimumOp TosaMinimumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(nan_mode), std::forward(input1), std::forward(input2)); } void TosaMinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); odsState.addTypes(output); } TosaMinimumOp TosaMinimumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(nan_mode), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMinimumOp TosaMinimumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(nan_mode), std::forward(input1), std::forward(input2)); } void TosaMinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaMinimumOp TosaMinimumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(nan_mode), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMinimumOp TosaMinimumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(nan_mode), std::forward(input1), std::forward(input2)); } void TosaMinimumOp::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(); ::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."); } } TosaMinimumOp TosaMinimumOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMinimumOp TosaMinimumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaMinimumOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaMinimumOp TosaMinimumOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMinimumOp TosaMinimumOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaMinimumOp::verifyInvariantsImpl() { auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitOpError("requires attribute 'nan_mode'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(*this, tblgen_nan_mode, "nan_mode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps55(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaMinimumOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaMinimumOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_modeAttr; ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("nan_mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(nan_modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (nan_modeAttr) result.getOrAddProperties().nan_mode = nan_modeAttr; if (parser.parseComma()) return ::mlir::failure(); input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaMinimumOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "nan_mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getNanModeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("nan_mode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaMinimumOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaMinimumOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaMinimumOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaMulOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaMulOpGenericAdaptorBase::TosaMulOpGenericAdaptorBase(TosaMulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaMulOpAdaptor::TosaMulOpAdaptor(TosaMulOp op) : TosaMulOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaMulOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaMulOp::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 TosaMulOp::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 TosaMulOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addOperands(shift); odsState.addTypes(output); } TosaMulOp TosaMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2), std::forward(shift)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMulOp TosaMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2), std::forward(shift)); } void TosaMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addOperands(shift); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaMulOp TosaMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2), std::forward(shift)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMulOp TosaMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2), std::forward(shift)); } void TosaMulOp::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); } TosaMulOp TosaMulOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMulOp TosaMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaMulOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaMulOp TosaMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaMulOp TosaMulOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaMulOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps81(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps81(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps82(*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_SPIRVOps55(*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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input1 has type 16-bit float then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))))) return emitOpError("failed to verify that if input1 has type 32-bit float then output must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))))) return emitOpError("failed to verify that if input1 has type bfloat16 type then output must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::IntegerType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))))) return emitOpError("failed to verify that if input1 has type integer then output must have a type in [32-bit signless integer]"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaMulOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand shiftRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> shiftOperands(&shiftRawOperand, 1); ::llvm::SMLoc shiftOperandsLoc; (void)shiftOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); shiftOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(shiftRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands, shiftOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getShift(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaMulOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaNegateOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaNegateOpGenericAdaptorBase::TosaNegateOpGenericAdaptorBase(TosaNegateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaNegateOpAdaptor::TosaNegateOpAdaptor(TosaNegateOp op) : TosaNegateOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaNegateOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaNegateOp::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 TosaNegateOp::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 TosaNegateOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaNegateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaNegateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaNegateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaNegateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { odsState.addOperands(input1); odsState.addOperands(input1_zp); odsState.addOperands(output_zp); odsState.addTypes(output); } TosaNegateOp TosaNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input1_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaNegateOp TosaNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input1_zp), std::forward(output_zp)); } void TosaNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { odsState.addOperands(input1); odsState.addOperands(input1_zp); odsState.addOperands(output_zp); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaNegateOp::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); } TosaNegateOp TosaNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1), std::forward(input1_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaNegateOp TosaNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(input1), std::forward(input1_zp), std::forward(output_zp)); } void TosaNegateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { odsState.addOperands(input1); odsState.addOperands(input1_zp); odsState.addOperands(output_zp); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaNegateOp TosaNegateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input1_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaNegateOp TosaNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input1_zp), std::forward(output_zp)); } void TosaNegateOp::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); } TosaNegateOp TosaNegateOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaNegateOp TosaNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaNegateOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaNegateOp::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)."); } } TosaNegateOp TosaNegateOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaNegateOp TosaNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaNegateOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaNegateOp TosaNegateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaNegateOp TosaNegateOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaNegateOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaNegateOp::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)."); } } TosaNegateOp TosaNegateOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaNegateOp TosaNegateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaNegateOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps81(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps83(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps83(*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_SPIRVOps81(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output, input1_zp, output_zp} have same element type"); if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaNegateOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaNegateOp::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 TosaNegateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input1_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1_zpOperands(&input1_zpRawOperand, 1); ::llvm::SMLoc input1_zpOperandsLoc; (void)input1_zpOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand output_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> output_zpOperands(&output_zpRawOperand, 1); ::llvm::SMLoc output_zpOperandsLoc; (void)output_zpOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input1_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1_zpRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); output_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(output_zpRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input1_zpOperands, output_zpOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaNegateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput1Zp(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOutputZp(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaNegateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaNegateOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaPadOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaPadOpGenericAdaptorBase::TosaPadOpGenericAdaptorBase(TosaPadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaPadOpAdaptor::TosaPadOpAdaptor(TosaPadOp op) : TosaPadOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaPadOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaPadOp::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 TosaPadOp::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 TosaPadOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaPadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaPadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaPadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaPadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaPadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const) { odsState.addOperands(input1); odsState.addOperands(padding); odsState.addOperands(pad_const); odsState.addTypes(output); } TosaPadOp TosaPadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(padding), std::forward(pad_const)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaPadOp TosaPadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(padding), std::forward(pad_const)); } void TosaPadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const) { odsState.addOperands(input1); odsState.addOperands(padding); odsState.addOperands(pad_const); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaPadOp TosaPadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(padding), std::forward(pad_const)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaPadOp TosaPadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(padding), std::forward(pad_const)); } void TosaPadOp::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); } TosaPadOp TosaPadOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaPadOp TosaPadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaPadOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaPadOp TosaPadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaPadOp TosaPadOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaPadOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps61(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps84(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps85(*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_SPIRVOps61(*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->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, pad_const, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, output} have same rank"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getNumElements() == 2 * ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that the number of elements of padding must be rank(input1) * 2"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaPadOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaPadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand paddingRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> paddingOperands(&paddingRawOperand, 1); ::llvm::SMLoc paddingOperandsLoc; (void)paddingOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand pad_constRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pad_constOperands(&pad_constRawOperand, 1); ::llvm::SMLoc pad_constOperandsLoc; (void)pad_constOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); paddingOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(paddingRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); pad_constOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(pad_constRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, paddingOperands, pad_constOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaPadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getPadding(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getPadConst(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaPadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaPadOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaPowOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaPowOpGenericAdaptorBase::TosaPowOpGenericAdaptorBase(TosaPowOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaPowOpAdaptor::TosaPowOpAdaptor(TosaPowOp op) : TosaPowOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaPowOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaPowOp::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 TosaPowOp::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 TosaPowOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaPowOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaPowOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaPowOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaPowOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaPowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaPowOp TosaPowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaPowOp TosaPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaPowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaPowOp TosaPowOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaPowOp TosaPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaPowOp::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); } TosaPowOp TosaPowOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaPowOp TosaPowOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaPowOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaPowOp TosaPowOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaPowOp TosaPowOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaPowOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaPowOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaPowOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaPowOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaPowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaPowOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaRFFT2DOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaRFFT2DOpGenericAdaptorBase::TosaRFFT2DOpGenericAdaptorBase(TosaRFFT2DOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} bool TosaRFFT2DOpGenericAdaptorBase::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } } // namespace detail TosaRFFT2DOpAdaptor::TosaRFFT2DOpAdaptor(TosaRFFT2DOp op) : TosaRFFT2DOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaRFFT2DOpAdaptor::verify(::mlir::Location loc) { auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitError(loc, "'spirv.Tosa.RFFT2D' op requires attribute 'local_bound'"); if (tblgen_local_bound && !((::llvm::isa<::mlir::BoolAttr>(tblgen_local_bound)))) return emitError(loc, "'spirv.Tosa.RFFT2D' op attribute 'local_bound' failed to satisfy constraint: bool attribute"); return ::mlir::success(); } ::llvm::LogicalResult TosaRFFT2DOp::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.local_bound; auto attr = dict.get("local_bound"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `local_bound` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaRFFT2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.local_bound; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("local_bound", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaRFFT2DOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.local_bound.getAsOpaquePointer())); } std::optional TosaRFFT2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "local_bound") return prop.local_bound; return std::nullopt; } void TosaRFFT2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "local_bound") { prop.local_bound = ::llvm::dyn_cast_or_null>(value); return; } } void TosaRFFT2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.local_bound) attrs.append("local_bound", prop.local_bound); } ::llvm::LogicalResult TosaRFFT2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getLocalBoundAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "local_bound", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaRFFT2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.local_bound))) return ::mlir::failure(); return ::mlir::success(); } void TosaRFFT2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.local_bound); } bool TosaRFFT2DOp::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } void TosaRFFT2DOp::setLocalBound(bool attrValue) { getProperties().local_bound = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaRFFT2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::BoolAttr local_bound, ::mlir::Value input_real) { odsState.addOperands(input_real); odsState.getOrAddProperties().local_bound = local_bound; odsState.addTypes(output); } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::BoolAttr local_bound, ::mlir::Value input_real) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(local_bound), std::forward(input_real)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::BoolAttr local_bound, ::mlir::Value input_real) { return create(builder, builder.getLoc(), std::forward(output), std::forward(local_bound), std::forward(input_real)); } void TosaRFFT2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr local_bound, ::mlir::Value input_real) { odsState.addOperands(input_real); odsState.getOrAddProperties().local_bound = local_bound; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr local_bound, ::mlir::Value input_real) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(local_bound), std::forward(input_real)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr local_bound, ::mlir::Value input_real) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(local_bound), std::forward(input_real)); } void TosaRFFT2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, bool local_bound, ::mlir::Value input_real) { odsState.addOperands(input_real); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); odsState.addTypes(output); } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, bool local_bound, ::mlir::Value input_real) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(local_bound), std::forward(input_real)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, bool local_bound, ::mlir::Value input_real) { return create(builder, builder.getLoc(), std::forward(output), std::forward(local_bound), std::forward(input_real)); } void TosaRFFT2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, bool local_bound, ::mlir::Value input_real) { odsState.addOperands(input_real); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, bool local_bound, ::mlir::Value input_real) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(local_bound), std::forward(input_real)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, bool local_bound, ::mlir::Value input_real) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(local_bound), std::forward(input_real)); } void TosaRFFT2DOp::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(); ::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."); } } TosaRFFT2DOp TosaRFFT2DOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRFFT2DOp TosaRFFT2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaRFFT2DOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaRFFT2DOp TosaRFFT2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRFFT2DOp TosaRFFT2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaRFFT2DOp::verifyInvariantsImpl() { auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitOpError("requires attribute 'local_bound'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_local_bound, "local_bound"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps75(*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_SPIRVOps76(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(getResultRealType().getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(getResultImagType().getDimSize(0)))) || (((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == getResultRealType().getDimSize(0))) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == getResultImagType().getDimSize(0))))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(getResultRealType().getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(getResultImagType().getDimSize(1)))) || (((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == getResultRealType().getDimSize(1))) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == getResultImagType().getDimSize(1))))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(getResultRealType().getDimSize(2)))) || ((getResultRealType().getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) / 2 + 1))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(getResultImagType().getDimSize(2)))) || ((getResultImagType().getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) / 2 + 1))))) return emitOpError("failed to verify that shapes of output_real and output_imag must satisfy [N,H,W/2 + 1] when input_real has shape [N,H,W]"); if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((llvm::isPowerOf2_64(static_cast(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((llvm::isPowerOf2_64(static_cast(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))))))) return emitOpError("failed to verify that dimensions 1, 2 of input_real must be powers of two"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaRFFT2DOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaRFFT2DOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::BoolAttr local_boundAttr; ::mlir::OpAsmParser::UnresolvedOperand input_realRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_realOperands(&input_realRawOperand, 1); ::llvm::SMLoc input_realOperandsLoc; (void)input_realOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("local_bound")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(local_boundAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (local_boundAttr) result.getOrAddProperties().local_bound = local_boundAttr; if (parser.parseComma()) return ::mlir::failure(); input_realOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_realRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input_realOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaRFFT2DOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "local_bound"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getLocalBoundAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputReal(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("local_bound"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaRFFT2DOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaRFFT2DOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaRFFT2DOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReciprocalOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReciprocalOpGenericAdaptorBase::TosaReciprocalOpGenericAdaptorBase(TosaReciprocalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaReciprocalOpAdaptor::TosaReciprocalOpAdaptor(TosaReciprocalOp op) : TosaReciprocalOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReciprocalOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaReciprocalOp::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 TosaReciprocalOp::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 TosaReciprocalOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaReciprocalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaReciprocalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaReciprocalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaReciprocalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaReciprocalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaReciprocalOp TosaReciprocalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReciprocalOp TosaReciprocalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaReciprocalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaReciprocalOp::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); } TosaReciprocalOp TosaReciprocalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReciprocalOp TosaReciprocalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaReciprocalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReciprocalOp TosaReciprocalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReciprocalOp TosaReciprocalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaReciprocalOp::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); } TosaReciprocalOp TosaReciprocalOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReciprocalOp TosaReciprocalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReciprocalOp::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(TosaReciprocalOp::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)."); } } TosaReciprocalOp TosaReciprocalOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReciprocalOp TosaReciprocalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaReciprocalOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReciprocalOp TosaReciprocalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReciprocalOp TosaReciprocalOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaReciprocalOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaReciprocalOp::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)."); } } TosaReciprocalOp TosaReciprocalOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReciprocalOp TosaReciprocalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReciprocalOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReciprocalOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaReciprocalOp::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 TosaReciprocalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReciprocalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReciprocalOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReciprocalOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReduceAllOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReduceAllOpGenericAdaptorBase::TosaReduceAllOpGenericAdaptorBase(TosaReduceAllOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t TosaReduceAllOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } } // namespace detail TosaReduceAllOpAdaptor::TosaReduceAllOpAdaptor(TosaReduceAllOp op) : TosaReduceAllOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReduceAllOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.ReduceAll' op requires attribute 'axis'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.ReduceAll' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceAllOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaReduceAllOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaReduceAllOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer())); } std::optional TosaReduceAllOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; return std::nullopt; } void TosaReduceAllOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } } void TosaReduceAllOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); } ::llvm::LogicalResult TosaReduceAllOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaReduceAllOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceAllOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); } uint32_t TosaReduceAllOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } void TosaReduceAllOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaReduceAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.addTypes(output); } TosaReduceAllOp TosaReduceAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAllOp TosaReduceAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input)); } void TosaReduceAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceAllOp TosaReduceAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAllOp TosaReduceAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input)); } void TosaReduceAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.addTypes(output); } TosaReduceAllOp TosaReduceAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAllOp TosaReduceAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input)); } void TosaReduceAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceAllOp TosaReduceAllOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAllOp TosaReduceAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input)); } void TosaReduceAllOp::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(); ::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."); } } TosaReduceAllOp TosaReduceAllOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAllOp TosaReduceAllOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReduceAllOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReduceAllOp TosaReduceAllOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAllOp TosaReduceAllOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReduceAllOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*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_SPIRVOps74(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input, output} have same rank"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(input)"); if (!(((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 0)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || (((getAxis() == 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0) == 1))) || (((getAxis() != 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 1)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) || (((getAxis() == 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1) == 1))) || (((getAxis() != 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 2)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))) || (((getAxis() == 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2) == 1))) || (((getAxis() != 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 3)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || (((getAxis() == 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3) == 1))) || (((getAxis() != 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 4)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || (((getAxis() == 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4) == 1))) || (((getAxis() != 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 5)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))) || (((getAxis() == 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5) == 1))) || (((getAxis() != 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))))))) return emitOpError("failed to verify that shape of output must match the shape of input with the dimension at axis replaced by 1"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceAllOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaReduceAllOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceAllOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReduceAllOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReduceAllOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaReduceAllOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReduceAnyOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReduceAnyOpGenericAdaptorBase::TosaReduceAnyOpGenericAdaptorBase(TosaReduceAnyOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t TosaReduceAnyOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } } // namespace detail TosaReduceAnyOpAdaptor::TosaReduceAnyOpAdaptor(TosaReduceAnyOp op) : TosaReduceAnyOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReduceAnyOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.ReduceAny' op requires attribute 'axis'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.ReduceAny' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceAnyOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaReduceAnyOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaReduceAnyOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer())); } std::optional TosaReduceAnyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; return std::nullopt; } void TosaReduceAnyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } } void TosaReduceAnyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); } ::llvm::LogicalResult TosaReduceAnyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaReduceAnyOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceAnyOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); } uint32_t TosaReduceAnyOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } void TosaReduceAnyOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaReduceAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.addTypes(output); } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input)); } void TosaReduceAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input)); } void TosaReduceAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.addTypes(output); } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input)); } void TosaReduceAnyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input)); } void TosaReduceAnyOp::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(); ::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."); } } TosaReduceAnyOp TosaReduceAnyOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAnyOp TosaReduceAnyOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReduceAnyOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReduceAnyOp TosaReduceAnyOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceAnyOp TosaReduceAnyOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReduceAnyOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*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_SPIRVOps74(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input, output} have same rank"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(input)"); if (!(((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 0)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || (((getAxis() == 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0) == 1))) || (((getAxis() != 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 1)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) || (((getAxis() == 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1) == 1))) || (((getAxis() != 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 2)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))) || (((getAxis() == 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2) == 1))) || (((getAxis() != 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 3)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || (((getAxis() == 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3) == 1))) || (((getAxis() != 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 4)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || (((getAxis() == 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4) == 1))) || (((getAxis() != 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 5)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))) || (((getAxis() == 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5) == 1))) || (((getAxis() != 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))))))) return emitOpError("failed to verify that shape of output must match the shape of input with the dimension at axis replaced by 1"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceAnyOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaReduceAnyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceAnyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReduceAnyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReduceAnyOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaReduceAnyOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReduceMaxOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReduceMaxOpGenericAdaptorBase::TosaReduceMaxOpGenericAdaptorBase(TosaReduceMaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t TosaReduceMaxOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } ::mlir::spirv::TosaExtNaNPropagationModeType TosaReduceMaxOpGenericAdaptorBase::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } } // namespace detail TosaReduceMaxOpAdaptor::TosaReduceMaxOpAdaptor(TosaReduceMaxOp op) : TosaReduceMaxOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReduceMaxOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.ReduceMax' op requires attribute 'axis'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitError(loc, "'spirv.Tosa.ReduceMax' op requires attribute 'nan_mode'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.ReduceMax' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); if (tblgen_nan_mode && !((::llvm::isa<::mlir::spirv::TosaExtNaNPropagationModeTypeAttr>(tblgen_nan_mode)))) return emitError(loc, "'spirv.Tosa.ReduceMax' op attribute 'nan_mode' failed to satisfy constraint: Tosa Ext NaN Propoagation Mode Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceMaxOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.nan_mode; auto attr = dict.get("nan_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `nan_mode` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaReduceMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } { const auto &propStorage = prop.nan_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("nan_mode", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaReduceMaxOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer()), llvm::hash_value(prop.nan_mode.getAsOpaquePointer())); } std::optional TosaReduceMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; if (name == "nan_mode") return prop.nan_mode; return std::nullopt; } void TosaReduceMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } if (name == "nan_mode") { prop.nan_mode = ::llvm::dyn_cast_or_null>(value); return; } } void TosaReduceMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); if (prop.nan_mode) attrs.append("nan_mode", prop.nan_mode); } ::llvm::LogicalResult TosaReduceMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getNanModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(attr, "nan_mode", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaReduceMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.nan_mode))) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); writer.writeAttribute(prop.nan_mode); } uint32_t TosaReduceMaxOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } ::mlir::spirv::TosaExtNaNPropagationModeType TosaReduceMaxOp::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } void TosaReduceMaxOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaReduceMaxOp::setNanMode(::mlir::spirv::TosaExtNaNPropagationModeType attrValue) { getProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaReduceMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.getOrAddProperties().nan_mode = nan_mode; odsState.addTypes(output); } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaReduceMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.getOrAddProperties().nan_mode = nan_mode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaReduceMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); odsState.addTypes(output); } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaReduceMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaReduceMaxOp::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(); ::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."); } } TosaReduceMaxOp TosaReduceMaxOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMaxOp TosaReduceMaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReduceMaxOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReduceMaxOp TosaReduceMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMaxOp TosaReduceMaxOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReduceMaxOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitOpError("requires attribute 'nan_mode'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(*this, tblgen_nan_mode, "nan_mode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps81(*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_SPIRVOps81(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input, output} have same rank"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(input)"); if (!(((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 0)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || (((getAxis() == 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0) == 1))) || (((getAxis() != 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 1)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) || (((getAxis() == 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1) == 1))) || (((getAxis() != 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 2)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))) || (((getAxis() == 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2) == 1))) || (((getAxis() != 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 3)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || (((getAxis() == 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3) == 1))) || (((getAxis() != 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 4)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || (((getAxis() == 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4) == 1))) || (((getAxis() != 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 5)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))) || (((getAxis() == 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5) == 1))) || (((getAxis() != 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))))))) return emitOpError("failed to verify that shape of output must match the shape of input with the dimension at axis replaced by 1"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceMaxOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaReduceMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_modeAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("nan_mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(nan_modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (nan_modeAttr) result.getOrAddProperties().nan_mode = nan_modeAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "nan_mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getNanModeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); elidedAttrs.push_back("nan_mode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReduceMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReduceMaxOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaReduceMaxOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReduceMinOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReduceMinOpGenericAdaptorBase::TosaReduceMinOpGenericAdaptorBase(TosaReduceMinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t TosaReduceMinOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } ::mlir::spirv::TosaExtNaNPropagationModeType TosaReduceMinOpGenericAdaptorBase::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } } // namespace detail TosaReduceMinOpAdaptor::TosaReduceMinOpAdaptor(TosaReduceMinOp op) : TosaReduceMinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReduceMinOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.ReduceMin' op requires attribute 'axis'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitError(loc, "'spirv.Tosa.ReduceMin' op requires attribute 'nan_mode'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.ReduceMin' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); if (tblgen_nan_mode && !((::llvm::isa<::mlir::spirv::TosaExtNaNPropagationModeTypeAttr>(tblgen_nan_mode)))) return emitError(loc, "'spirv.Tosa.ReduceMin' op attribute 'nan_mode' failed to satisfy constraint: Tosa Ext NaN Propoagation Mode Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceMinOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.nan_mode; auto attr = dict.get("nan_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `nan_mode` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaReduceMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } { const auto &propStorage = prop.nan_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("nan_mode", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaReduceMinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer()), llvm::hash_value(prop.nan_mode.getAsOpaquePointer())); } std::optional TosaReduceMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; if (name == "nan_mode") return prop.nan_mode; return std::nullopt; } void TosaReduceMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } if (name == "nan_mode") { prop.nan_mode = ::llvm::dyn_cast_or_null>(value); return; } } void TosaReduceMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); if (prop.nan_mode) attrs.append("nan_mode", prop.nan_mode); } ::llvm::LogicalResult TosaReduceMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getNanModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(attr, "nan_mode", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaReduceMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.nan_mode))) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); writer.writeAttribute(prop.nan_mode); } uint32_t TosaReduceMinOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } ::mlir::spirv::TosaExtNaNPropagationModeType TosaReduceMinOp::getNanMode() { auto attr = getNanModeAttr(); return attr.getValue(); } void TosaReduceMinOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaReduceMinOp::setNanMode(::mlir::spirv::TosaExtNaNPropagationModeType attrValue) { getProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaReduceMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.getOrAddProperties().nan_mode = nan_mode; odsState.addTypes(output); } TosaReduceMinOp TosaReduceMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMinOp TosaReduceMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaReduceMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.getOrAddProperties().nan_mode = nan_mode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceMinOp TosaReduceMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMinOp TosaReduceMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaReduceMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); odsState.addTypes(output); } TosaReduceMinOp TosaReduceMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMinOp TosaReduceMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaReduceMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.getOrAddProperties().nan_mode = ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr::get(odsBuilder.getContext(), nan_mode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceMinOp TosaReduceMinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMinOp TosaReduceMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::spirv::TosaExtNaNPropagationModeType nan_mode, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(nan_mode), std::forward(input)); } void TosaReduceMinOp::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(); ::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."); } } TosaReduceMinOp TosaReduceMinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMinOp TosaReduceMinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReduceMinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReduceMinOp TosaReduceMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceMinOp TosaReduceMinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReduceMinOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); auto tblgen_nan_mode = getProperties().nan_mode; (void)tblgen_nan_mode; if (!tblgen_nan_mode) return emitOpError("requires attribute 'nan_mode'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps37(*this, tblgen_nan_mode, "nan_mode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps81(*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_SPIRVOps81(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input, output} have same rank"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(input)"); if (!(((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 0)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || (((getAxis() == 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0) == 1))) || (((getAxis() != 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 1)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) || (((getAxis() == 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1) == 1))) || (((getAxis() != 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 2)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))) || (((getAxis() == 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2) == 1))) || (((getAxis() != 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 3)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || (((getAxis() == 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3) == 1))) || (((getAxis() != 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 4)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || (((getAxis() == 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4) == 1))) || (((getAxis() != 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 5)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))) || (((getAxis() == 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5) == 1))) || (((getAxis() != 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))))))) return emitOpError("failed to verify that shape of output must match the shape of input with the dimension at axis replaced by 1"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceMinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaReduceMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::mlir::spirv::TosaExtNaNPropagationModeTypeAttr nan_modeAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("nan_mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(nan_modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (nan_modeAttr) result.getOrAddProperties().nan_mode = nan_modeAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "nan_mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getNanModeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); elidedAttrs.push_back("nan_mode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReduceMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReduceMinOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaReduceMinOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReduceProductOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReduceProductOpGenericAdaptorBase::TosaReduceProductOpGenericAdaptorBase(TosaReduceProductOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t TosaReduceProductOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } } // namespace detail TosaReduceProductOpAdaptor::TosaReduceProductOpAdaptor(TosaReduceProductOp op) : TosaReduceProductOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReduceProductOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.ReduceProduct' op requires attribute 'axis'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.ReduceProduct' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceProductOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaReduceProductOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaReduceProductOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer())); } std::optional TosaReduceProductOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; return std::nullopt; } void TosaReduceProductOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } } void TosaReduceProductOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); } ::llvm::LogicalResult TosaReduceProductOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaReduceProductOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceProductOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); } uint32_t TosaReduceProductOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } void TosaReduceProductOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaReduceProductOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.addTypes(output); } TosaReduceProductOp TosaReduceProductOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceProductOp TosaReduceProductOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input)); } void TosaReduceProductOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceProductOp TosaReduceProductOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceProductOp TosaReduceProductOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input)); } void TosaReduceProductOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.addTypes(output); } TosaReduceProductOp TosaReduceProductOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceProductOp TosaReduceProductOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input)); } void TosaReduceProductOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceProductOp TosaReduceProductOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceProductOp TosaReduceProductOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input)); } void TosaReduceProductOp::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(); ::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."); } } TosaReduceProductOp TosaReduceProductOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceProductOp TosaReduceProductOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReduceProductOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReduceProductOp TosaReduceProductOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceProductOp TosaReduceProductOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReduceProductOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input, output} have same rank"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(input)"); if (!(((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 0)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || (((getAxis() == 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0) == 1))) || (((getAxis() != 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 1)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) || (((getAxis() == 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1) == 1))) || (((getAxis() != 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 2)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))) || (((getAxis() == 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2) == 1))) || (((getAxis() != 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 3)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || (((getAxis() == 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3) == 1))) || (((getAxis() != 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 4)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || (((getAxis() == 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4) == 1))) || (((getAxis() != 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 5)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))) || (((getAxis() == 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5) == 1))) || (((getAxis() != 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))))))) return emitOpError("failed to verify that shape of output must match the shape of input with the dimension at axis replaced by 1"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceProductOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaReduceProductOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceProductOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReduceProductOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReduceProductOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaReduceProductOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReduceSumOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReduceSumOpGenericAdaptorBase::TosaReduceSumOpGenericAdaptorBase(TosaReduceSumOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t TosaReduceSumOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } } // namespace detail TosaReduceSumOpAdaptor::TosaReduceSumOpAdaptor(TosaReduceSumOp op) : TosaReduceSumOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReduceSumOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.ReduceSum' op requires attribute 'axis'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.ReduceSum' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceSumOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaReduceSumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaReduceSumOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer())); } std::optional TosaReduceSumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; return std::nullopt; } void TosaReduceSumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } } void TosaReduceSumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); } ::llvm::LogicalResult TosaReduceSumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaReduceSumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceSumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); } uint32_t TosaReduceSumOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } void TosaReduceSumOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaReduceSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; odsState.addTypes(output); } TosaReduceSumOp TosaReduceSumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceSumOp TosaReduceSumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input)); } void TosaReduceSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = axis; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceSumOp TosaReduceSumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceSumOp TosaReduceSumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input)); } void TosaReduceSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.addTypes(output); } TosaReduceSumOp TosaReduceSumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceSumOp TosaReduceSumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input)); } void TosaReduceSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { odsState.addOperands(input); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReduceSumOp TosaReduceSumOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceSumOp TosaReduceSumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input)); } void TosaReduceSumOp::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(); ::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."); } } TosaReduceSumOp TosaReduceSumOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceSumOp TosaReduceSumOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReduceSumOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReduceSumOp TosaReduceSumOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReduceSumOp TosaReduceSumOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReduceSumOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps55(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input, output} have same rank"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(input)"); if (!(((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 0)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || (((getAxis() == 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0) == 1))) || (((getAxis() != 0)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 1)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))) || (((getAxis() == 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1) == 1))) || (((getAxis() != 1)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(1)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 2)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))) || (((getAxis() == 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2) == 1))) || (((getAxis() != 2)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(2)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 3)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || (((getAxis() == 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3) == 1))) || (((getAxis() != 3)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 4)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))) || (((getAxis() == 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4) == 1))) || (((getAxis() != 4)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(4) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(4)))))) && ((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() > 5)))) || (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))) || (((getAxis() == 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5) == 1))) || (((getAxis() != 5)) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(5) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(5)))))))) return emitOpError("failed to verify that shape of output must match the shape of input with the dimension at axis replaced by 1"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReduceSumOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaReduceSumOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReduceSumOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReduceSumOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReduceSumOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaReduceSumOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaRescaleOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaRescaleOpGenericAdaptorBase::TosaRescaleOpGenericAdaptorBase(TosaRescaleOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} bool TosaRescaleOpGenericAdaptorBase::getScale32() { auto attr = getScale32Attr(); return attr.getValue(); } ::mlir::spirv::TosaExtRoundingModeType TosaRescaleOpGenericAdaptorBase::getRoundingMode() { auto attr = getRoundingModeAttr(); return attr.getValue(); } bool TosaRescaleOpGenericAdaptorBase::getPerChannel() { auto attr = getPerChannelAttr(); return attr.getValue(); } bool TosaRescaleOpGenericAdaptorBase::getInputUnsigned() { auto attr = getInputUnsignedAttr(); return attr.getValue(); } bool TosaRescaleOpGenericAdaptorBase::getOutputUnsigned() { auto attr = getOutputUnsignedAttr(); return attr.getValue(); } } // namespace detail TosaRescaleOpAdaptor::TosaRescaleOpAdaptor(TosaRescaleOp op) : TosaRescaleOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaRescaleOpAdaptor::verify(::mlir::Location loc) { auto tblgen_input_unsigned = getProperties().input_unsigned; (void)tblgen_input_unsigned; if (!tblgen_input_unsigned) return emitError(loc, "'spirv.Tosa.Rescale' op requires attribute 'input_unsigned'"); auto tblgen_output_unsigned = getProperties().output_unsigned; (void)tblgen_output_unsigned; if (!tblgen_output_unsigned) return emitError(loc, "'spirv.Tosa.Rescale' op requires attribute 'output_unsigned'"); auto tblgen_per_channel = getProperties().per_channel; (void)tblgen_per_channel; if (!tblgen_per_channel) return emitError(loc, "'spirv.Tosa.Rescale' op requires attribute 'per_channel'"); auto tblgen_rounding_mode = getProperties().rounding_mode; (void)tblgen_rounding_mode; if (!tblgen_rounding_mode) return emitError(loc, "'spirv.Tosa.Rescale' op requires attribute 'rounding_mode'"); auto tblgen_scale32 = getProperties().scale32; (void)tblgen_scale32; if (!tblgen_scale32) return emitError(loc, "'spirv.Tosa.Rescale' op requires attribute 'scale32'"); if (tblgen_scale32 && !((::llvm::isa<::mlir::BoolAttr>(tblgen_scale32)))) return emitError(loc, "'spirv.Tosa.Rescale' op attribute 'scale32' failed to satisfy constraint: bool attribute"); if (tblgen_rounding_mode && !((::llvm::isa<::mlir::spirv::TosaExtRoundingModeTypeAttr>(tblgen_rounding_mode)))) return emitError(loc, "'spirv.Tosa.Rescale' op attribute 'rounding_mode' failed to satisfy constraint: Tosa Ext Rounding Mode Type"); if (tblgen_per_channel && !((::llvm::isa<::mlir::BoolAttr>(tblgen_per_channel)))) return emitError(loc, "'spirv.Tosa.Rescale' op attribute 'per_channel' failed to satisfy constraint: bool attribute"); if (tblgen_input_unsigned && !((::llvm::isa<::mlir::BoolAttr>(tblgen_input_unsigned)))) return emitError(loc, "'spirv.Tosa.Rescale' op attribute 'input_unsigned' failed to satisfy constraint: bool attribute"); if (tblgen_output_unsigned && !((::llvm::isa<::mlir::BoolAttr>(tblgen_output_unsigned)))) return emitError(loc, "'spirv.Tosa.Rescale' op attribute 'output_unsigned' failed to satisfy constraint: bool attribute"); return ::mlir::success(); } ::llvm::LogicalResult TosaRescaleOp::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.input_unsigned; auto attr = dict.get("input_unsigned"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `input_unsigned` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.output_unsigned; auto attr = dict.get("output_unsigned"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `output_unsigned` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.per_channel; auto attr = dict.get("per_channel"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `per_channel` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.rounding_mode; auto attr = dict.get("rounding_mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `rounding_mode` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.scale32; auto attr = dict.get("scale32"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `scale32` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaRescaleOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.input_unsigned; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("input_unsigned", propStorage)); } { const auto &propStorage = prop.output_unsigned; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("output_unsigned", propStorage)); } { const auto &propStorage = prop.per_channel; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("per_channel", propStorage)); } { const auto &propStorage = prop.rounding_mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("rounding_mode", propStorage)); } { const auto &propStorage = prop.scale32; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("scale32", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaRescaleOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.input_unsigned.getAsOpaquePointer()), llvm::hash_value(prop.output_unsigned.getAsOpaquePointer()), llvm::hash_value(prop.per_channel.getAsOpaquePointer()), llvm::hash_value(prop.rounding_mode.getAsOpaquePointer()), llvm::hash_value(prop.scale32.getAsOpaquePointer())); } std::optional TosaRescaleOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "input_unsigned") return prop.input_unsigned; if (name == "output_unsigned") return prop.output_unsigned; if (name == "per_channel") return prop.per_channel; if (name == "rounding_mode") return prop.rounding_mode; if (name == "scale32") return prop.scale32; return std::nullopt; } void TosaRescaleOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "input_unsigned") { prop.input_unsigned = ::llvm::dyn_cast_or_null>(value); return; } if (name == "output_unsigned") { prop.output_unsigned = ::llvm::dyn_cast_or_null>(value); return; } if (name == "per_channel") { prop.per_channel = ::llvm::dyn_cast_or_null>(value); return; } if (name == "rounding_mode") { prop.rounding_mode = ::llvm::dyn_cast_or_null>(value); return; } if (name == "scale32") { prop.scale32 = ::llvm::dyn_cast_or_null>(value); return; } } void TosaRescaleOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.input_unsigned) attrs.append("input_unsigned", prop.input_unsigned); if (prop.output_unsigned) attrs.append("output_unsigned", prop.output_unsigned); if (prop.per_channel) attrs.append("per_channel", prop.per_channel); if (prop.rounding_mode) attrs.append("rounding_mode", prop.rounding_mode); if (prop.scale32) attrs.append("scale32", prop.scale32); } ::llvm::LogicalResult TosaRescaleOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getInputUnsignedAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "input_unsigned", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getOutputUnsignedAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "output_unsigned", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getPerChannelAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "per_channel", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getRoundingModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps45(attr, "rounding_mode", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getScale32AttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "scale32", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaRescaleOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.input_unsigned))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.output_unsigned))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.per_channel))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.rounding_mode))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.scale32))) return ::mlir::failure(); return ::mlir::success(); } void TosaRescaleOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.input_unsigned); writer.writeAttribute(prop.output_unsigned); writer.writeAttribute(prop.per_channel); writer.writeAttribute(prop.rounding_mode); writer.writeAttribute(prop.scale32); } bool TosaRescaleOp::getScale32() { auto attr = getScale32Attr(); return attr.getValue(); } ::mlir::spirv::TosaExtRoundingModeType TosaRescaleOp::getRoundingMode() { auto attr = getRoundingModeAttr(); return attr.getValue(); } bool TosaRescaleOp::getPerChannel() { auto attr = getPerChannelAttr(); return attr.getValue(); } bool TosaRescaleOp::getInputUnsigned() { auto attr = getInputUnsignedAttr(); return attr.getValue(); } bool TosaRescaleOp::getOutputUnsigned() { auto attr = getOutputUnsignedAttr(); return attr.getValue(); } void TosaRescaleOp::setScale32(bool attrValue) { getProperties().scale32 = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaRescaleOp::setRoundingMode(::mlir::spirv::TosaExtRoundingModeType attrValue) { getProperties().rounding_mode = ::mlir::spirv::TosaExtRoundingModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaRescaleOp::setPerChannel(bool attrValue) { getProperties().per_channel = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaRescaleOp::setInputUnsigned(bool attrValue) { getProperties().input_unsigned = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaRescaleOp::setOutputUnsigned(bool attrValue) { getProperties().output_unsigned = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaRescaleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::BoolAttr scale32, ::mlir::spirv::TosaExtRoundingModeTypeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { odsState.addOperands(input); odsState.addOperands(multiplier); odsState.addOperands(shift); odsState.addOperands(input_zp); odsState.addOperands(output_zp); odsState.getOrAddProperties().scale32 = scale32; odsState.getOrAddProperties().rounding_mode = rounding_mode; odsState.getOrAddProperties().per_channel = per_channel; odsState.getOrAddProperties().input_unsigned = input_unsigned; odsState.getOrAddProperties().output_unsigned = output_unsigned; odsState.addTypes(output); } TosaRescaleOp TosaRescaleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::BoolAttr scale32, ::mlir::spirv::TosaExtRoundingModeTypeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(scale32), std::forward(rounding_mode), std::forward(per_channel), std::forward(input_unsigned), std::forward(output_unsigned), std::forward(input), std::forward(multiplier), std::forward(shift), std::forward(input_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRescaleOp TosaRescaleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::BoolAttr scale32, ::mlir::spirv::TosaExtRoundingModeTypeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(scale32), std::forward(rounding_mode), std::forward(per_channel), std::forward(input_unsigned), std::forward(output_unsigned), std::forward(input), std::forward(multiplier), std::forward(shift), std::forward(input_zp), std::forward(output_zp)); } void TosaRescaleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr scale32, ::mlir::spirv::TosaExtRoundingModeTypeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { odsState.addOperands(input); odsState.addOperands(multiplier); odsState.addOperands(shift); odsState.addOperands(input_zp); odsState.addOperands(output_zp); odsState.getOrAddProperties().scale32 = scale32; odsState.getOrAddProperties().rounding_mode = rounding_mode; odsState.getOrAddProperties().per_channel = per_channel; odsState.getOrAddProperties().input_unsigned = input_unsigned; odsState.getOrAddProperties().output_unsigned = output_unsigned; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaRescaleOp TosaRescaleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr scale32, ::mlir::spirv::TosaExtRoundingModeTypeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(scale32), std::forward(rounding_mode), std::forward(per_channel), std::forward(input_unsigned), std::forward(output_unsigned), std::forward(input), std::forward(multiplier), std::forward(shift), std::forward(input_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRescaleOp TosaRescaleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr scale32, ::mlir::spirv::TosaExtRoundingModeTypeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(scale32), std::forward(rounding_mode), std::forward(per_channel), std::forward(input_unsigned), std::forward(output_unsigned), std::forward(input), std::forward(multiplier), std::forward(shift), std::forward(input_zp), std::forward(output_zp)); } void TosaRescaleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, bool scale32, ::mlir::spirv::TosaExtRoundingModeType rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { odsState.addOperands(input); odsState.addOperands(multiplier); odsState.addOperands(shift); odsState.addOperands(input_zp); odsState.addOperands(output_zp); odsState.getOrAddProperties().scale32 = odsBuilder.getBoolAttr(scale32); odsState.getOrAddProperties().rounding_mode = ::mlir::spirv::TosaExtRoundingModeTypeAttr::get(odsBuilder.getContext(), rounding_mode); odsState.getOrAddProperties().per_channel = odsBuilder.getBoolAttr(per_channel); odsState.getOrAddProperties().input_unsigned = odsBuilder.getBoolAttr(input_unsigned); odsState.getOrAddProperties().output_unsigned = odsBuilder.getBoolAttr(output_unsigned); odsState.addTypes(output); } TosaRescaleOp TosaRescaleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, bool scale32, ::mlir::spirv::TosaExtRoundingModeType rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(scale32), std::forward(rounding_mode), std::forward(per_channel), std::forward(input_unsigned), std::forward(output_unsigned), std::forward(input), std::forward(multiplier), std::forward(shift), std::forward(input_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRescaleOp TosaRescaleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, bool scale32, ::mlir::spirv::TosaExtRoundingModeType rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(scale32), std::forward(rounding_mode), std::forward(per_channel), std::forward(input_unsigned), std::forward(output_unsigned), std::forward(input), std::forward(multiplier), std::forward(shift), std::forward(input_zp), std::forward(output_zp)); } void TosaRescaleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, bool scale32, ::mlir::spirv::TosaExtRoundingModeType rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { odsState.addOperands(input); odsState.addOperands(multiplier); odsState.addOperands(shift); odsState.addOperands(input_zp); odsState.addOperands(output_zp); odsState.getOrAddProperties().scale32 = odsBuilder.getBoolAttr(scale32); odsState.getOrAddProperties().rounding_mode = ::mlir::spirv::TosaExtRoundingModeTypeAttr::get(odsBuilder.getContext(), rounding_mode); odsState.getOrAddProperties().per_channel = odsBuilder.getBoolAttr(per_channel); odsState.getOrAddProperties().input_unsigned = odsBuilder.getBoolAttr(input_unsigned); odsState.getOrAddProperties().output_unsigned = odsBuilder.getBoolAttr(output_unsigned); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaRescaleOp TosaRescaleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, bool scale32, ::mlir::spirv::TosaExtRoundingModeType rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(scale32), std::forward(rounding_mode), std::forward(per_channel), std::forward(input_unsigned), std::forward(output_unsigned), std::forward(input), std::forward(multiplier), std::forward(shift), std::forward(input_zp), std::forward(output_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRescaleOp TosaRescaleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, bool scale32, ::mlir::spirv::TosaExtRoundingModeType rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(scale32), std::forward(rounding_mode), std::forward(per_channel), std::forward(input_unsigned), std::forward(output_unsigned), std::forward(input), std::forward(multiplier), std::forward(shift), std::forward(input_zp), std::forward(output_zp)); } void TosaRescaleOp::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(); ::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."); } } TosaRescaleOp TosaRescaleOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRescaleOp TosaRescaleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaRescaleOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaRescaleOp TosaRescaleOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRescaleOp TosaRescaleOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaRescaleOp::verifyInvariantsImpl() { auto tblgen_input_unsigned = getProperties().input_unsigned; (void)tblgen_input_unsigned; if (!tblgen_input_unsigned) return emitOpError("requires attribute 'input_unsigned'"); auto tblgen_output_unsigned = getProperties().output_unsigned; (void)tblgen_output_unsigned; if (!tblgen_output_unsigned) return emitOpError("requires attribute 'output_unsigned'"); auto tblgen_per_channel = getProperties().per_channel; (void)tblgen_per_channel; if (!tblgen_per_channel) return emitOpError("requires attribute 'per_channel'"); auto tblgen_rounding_mode = getProperties().rounding_mode; (void)tblgen_rounding_mode; if (!tblgen_rounding_mode) return emitOpError("requires attribute 'rounding_mode'"); auto tblgen_scale32 = getProperties().scale32; (void)tblgen_scale32; if (!tblgen_scale32) return emitOpError("requires attribute 'scale32'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_scale32, "scale32"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps45(*this, tblgen_rounding_mode, "rounding_mode"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_per_channel, "per_channel"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_input_unsigned, "input_unsigned"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_output_unsigned, "output_unsigned"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps86(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps87(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps88(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps89(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup4 = getODSOperands(4); for (auto v : valueGroup4) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps90(*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_SPIRVOps58(*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 {input, output} have same shape"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, input_zp} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin())))))) return emitOpError("failed to verify that all of {output, output_zp} have same element type"); if (!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getElementType().isInteger(getScale32() ? 32 : 16)))) return emitOpError("failed to verify that multiplier must have element type i32 when scale32 is true, otherwise i16"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || (!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank()))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || (((getPerChannel())) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape().back()))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape().back())))) || ((!((getPerChannel()))) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0) == 1))))) return emitOpError("failed to verify that multiplier must have length input_shape[rank(input) - 1] when per_channel is true, otherwise length 1"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || (!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).hasRank()))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) || (((getPerChannel())) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape().back()))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape().back())))) || ((!((getPerChannel()))) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == 1))))) return emitOpError("failed to verify that shift must have length input_shape[rank(input) - 1] when per_channel is true, otherwise length 1"); if (!((!((getInputUnsigned()))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))))) return emitOpError("failed to verify that if input_unsigned is true then input must have a type in [8-bit signless integer,16-bit signless integer]"); if (!((!((getOutputUnsigned()))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))))) return emitOpError("failed to verify that if output_unsigned is true then input must have a type in [8-bit signless integer,16-bit signless integer]"); if (!((!((getInputUnsigned()))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16))))))) return emitOpError("failed to verify that if input_unsigned is true then output must have a type in [8-bit signless integer,16-bit signless integer]"); if (!((!((getOutputUnsigned()))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16))))))) return emitOpError("failed to verify that if output_unsigned is true then output must have a type in [8-bit signless integer,16-bit signless integer]"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaRescaleOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaRescaleOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::BoolAttr scale32Attr; ::mlir::spirv::TosaExtRoundingModeTypeAttr rounding_modeAttr; ::mlir::BoolAttr per_channelAttr; ::mlir::BoolAttr input_unsignedAttr; ::mlir::BoolAttr output_unsignedAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand multiplierRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> multiplierOperands(&multiplierRawOperand, 1); ::llvm::SMLoc multiplierOperandsLoc; (void)multiplierOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand shiftRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> shiftOperands(&shiftRawOperand, 1); ::llvm::SMLoc shiftOperandsLoc; (void)shiftOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_zpOperands(&input_zpRawOperand, 1); ::llvm::SMLoc input_zpOperandsLoc; (void)input_zpOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand output_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> output_zpOperands(&output_zpRawOperand, 1); ::llvm::SMLoc output_zpOperandsLoc; (void)output_zpOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("scale32")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(scale32Attr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (scale32Attr) result.getOrAddProperties().scale32 = scale32Attr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("rounding_mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(rounding_modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (rounding_modeAttr) result.getOrAddProperties().rounding_mode = rounding_modeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("per_channel")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(per_channelAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (per_channelAttr) result.getOrAddProperties().per_channel = per_channelAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("input_unsigned")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(input_unsignedAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (input_unsignedAttr) result.getOrAddProperties().input_unsigned = input_unsignedAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("output_unsigned")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(output_unsignedAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (output_unsignedAttr) result.getOrAddProperties().output_unsigned = output_unsignedAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); multiplierOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(multiplierRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); shiftOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(shiftRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_zpRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); output_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(output_zpRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(inputOperands, multiplierOperands, shiftOperands, input_zpOperands, output_zpOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaRescaleOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "scale32"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getScale32Attr()); _odsPrinter << ","; _odsPrinter << ' ' << "rounding_mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getRoundingModeAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "per_channel"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getPerChannelAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "input_unsigned"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getInputUnsignedAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "output_unsigned"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getOutputUnsignedAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getMultiplier(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getShift(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputZp(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOutputZp(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("scale32"); elidedAttrs.push_back("rounding_mode"); elidedAttrs.push_back("per_channel"); elidedAttrs.push_back("input_unsigned"); elidedAttrs.push_back("output_unsigned"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaRescaleOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaRescaleOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaRescaleOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReshapeOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReshapeOpGenericAdaptorBase::TosaReshapeOpGenericAdaptorBase(TosaReshapeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaReshapeOpAdaptor::TosaReshapeOpAdaptor(TosaReshapeOp op) : TosaReshapeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReshapeOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaReshapeOp::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 TosaReshapeOp::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 TosaReshapeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaReshapeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaReshapeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaReshapeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaReshapeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaReshapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value shape) { odsState.addOperands(input1); odsState.addOperands(shape); odsState.addTypes(output); } TosaReshapeOp TosaReshapeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value shape) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(shape)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReshapeOp TosaReshapeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value shape) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(shape)); } void TosaReshapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value shape) { odsState.addOperands(input1); odsState.addOperands(shape); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReshapeOp TosaReshapeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value shape) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(shape)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReshapeOp TosaReshapeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value shape) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(shape)); } void TosaReshapeOp::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); } TosaReshapeOp TosaReshapeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReshapeOp TosaReshapeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReshapeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReshapeOp TosaReshapeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReshapeOp TosaReshapeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReshapeOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps61(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps91(*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_SPIRVOps61(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); if (!((!(((!::mlir::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()) || !::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasStaticShape()) || (!::mlir::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()) || !::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasStaticShape())))) && (((llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getNumElements()) == (llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getNumElements()) && (llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getNumElements()) == (llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getNumElements()))))) return emitOpError("failed to verify that all of {input1, output} have same element count"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank()))) || ((llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getNumElements() == 1 * ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that the number of elements of shape must be rank(output)"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReshapeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaReshapeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand shapeRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> shapeOperands(&shapeRawOperand, 1); ::llvm::SMLoc shapeOperandsLoc; (void)shapeOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); shapeOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(shapeRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, shapeOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReshapeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getShape(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReshapeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReshapeOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaResizeOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaResizeOpGenericAdaptorBase::TosaResizeOpGenericAdaptorBase(TosaResizeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::spirv::TosaExtResizeModeType TosaResizeOpGenericAdaptorBase::getMode() { auto attr = getModeAttr(); return attr.getValue(); } } // namespace detail TosaResizeOpAdaptor::TosaResizeOpAdaptor(TosaResizeOp op) : TosaResizeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaResizeOpAdaptor::verify(::mlir::Location loc) { auto tblgen_mode = getProperties().mode; (void)tblgen_mode; if (!tblgen_mode) return emitError(loc, "'spirv.Tosa.Resize' op requires attribute 'mode'"); if (tblgen_mode && !((::llvm::isa<::mlir::spirv::TosaExtResizeModeTypeAttr>(tblgen_mode)))) return emitError(loc, "'spirv.Tosa.Resize' op attribute 'mode' failed to satisfy constraint: Tosa Ext Resize Mode Type"); return ::mlir::success(); } ::llvm::LogicalResult TosaResizeOp::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.mode; auto attr = dict.get("mode"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `mode` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaResizeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.mode; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("mode", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaResizeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.mode.getAsOpaquePointer())); } std::optional TosaResizeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "mode") return prop.mode; return std::nullopt; } void TosaResizeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "mode") { prop.mode = ::llvm::dyn_cast_or_null>(value); return; } } void TosaResizeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.mode) attrs.append("mode", prop.mode); } ::llvm::LogicalResult TosaResizeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getModeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps46(attr, "mode", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaResizeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.mode))) return ::mlir::failure(); return ::mlir::success(); } void TosaResizeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.mode); } ::mlir::spirv::TosaExtResizeModeType TosaResizeOp::getMode() { auto attr = getModeAttr(); return attr.getValue(); } void TosaResizeOp::setMode(::mlir::spirv::TosaExtResizeModeType attrValue) { getProperties().mode = ::mlir::spirv::TosaExtResizeModeTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaResizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::spirv::TosaExtResizeModeTypeAttr mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { odsState.addOperands(input); odsState.addOperands(scale); odsState.addOperands(offset); odsState.addOperands(border); odsState.getOrAddProperties().mode = mode; odsState.addTypes(output); } TosaResizeOp TosaResizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::spirv::TosaExtResizeModeTypeAttr mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(mode), std::forward(input), std::forward(scale), std::forward(offset), std::forward(border)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaResizeOp TosaResizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::spirv::TosaExtResizeModeTypeAttr mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { return create(builder, builder.getLoc(), std::forward(output), std::forward(mode), std::forward(input), std::forward(scale), std::forward(offset), std::forward(border)); } void TosaResizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtResizeModeTypeAttr mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { odsState.addOperands(input); odsState.addOperands(scale); odsState.addOperands(offset); odsState.addOperands(border); odsState.getOrAddProperties().mode = mode; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaResizeOp TosaResizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtResizeModeTypeAttr mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(mode), std::forward(input), std::forward(scale), std::forward(offset), std::forward(border)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaResizeOp TosaResizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtResizeModeTypeAttr mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(mode), std::forward(input), std::forward(scale), std::forward(offset), std::forward(border)); } void TosaResizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::spirv::TosaExtResizeModeType mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { odsState.addOperands(input); odsState.addOperands(scale); odsState.addOperands(offset); odsState.addOperands(border); odsState.getOrAddProperties().mode = ::mlir::spirv::TosaExtResizeModeTypeAttr::get(odsBuilder.getContext(), mode); odsState.addTypes(output); } TosaResizeOp TosaResizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::spirv::TosaExtResizeModeType mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(mode), std::forward(input), std::forward(scale), std::forward(offset), std::forward(border)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaResizeOp TosaResizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::spirv::TosaExtResizeModeType mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { return create(builder, builder.getLoc(), std::forward(output), std::forward(mode), std::forward(input), std::forward(scale), std::forward(offset), std::forward(border)); } void TosaResizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtResizeModeType mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { odsState.addOperands(input); odsState.addOperands(scale); odsState.addOperands(offset); odsState.addOperands(border); odsState.getOrAddProperties().mode = ::mlir::spirv::TosaExtResizeModeTypeAttr::get(odsBuilder.getContext(), mode); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaResizeOp TosaResizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtResizeModeType mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(mode), std::forward(input), std::forward(scale), std::forward(offset), std::forward(border)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaResizeOp TosaResizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::TosaExtResizeModeType mode, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(mode), std::forward(input), std::forward(scale), std::forward(offset), std::forward(border)); } void TosaResizeOp::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(); ::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."); } } TosaResizeOp TosaResizeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaResizeOp TosaResizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaResizeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaResizeOp TosaResizeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaResizeOp TosaResizeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaResizeOp::verifyInvariantsImpl() { auto tblgen_mode = getProperties().mode; (void)tblgen_mode; if (!tblgen_mode) return emitOpError("requires attribute 'mode'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps46(*this, tblgen_mode, "mode"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps92(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps93(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps94(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps94(*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_SPIRVOps95(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then output must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then output must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32))))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then output must have a type in [8-bit signless integer,32-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || ((((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16)))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(64))))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then output must have a type in [16-bit signless integer,64-bit signless integer]"); if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))))) return emitOpError("failed to verify that shapes of input and output must satisfy [N,*,*,C] and [N,*,*,C]"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaResizeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaResizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::spirv::TosaExtResizeModeTypeAttr modeAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand scaleRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> scaleOperands(&scaleRawOperand, 1); ::llvm::SMLoc scaleOperandsLoc; (void)scaleOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand offsetRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> offsetOperands(&offsetRawOperand, 1); ::llvm::SMLoc offsetOperandsLoc; (void)offsetOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand borderRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> borderOperands(&borderRawOperand, 1); ::llvm::SMLoc borderOperandsLoc; (void)borderOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("mode")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(modeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (modeAttr) result.getOrAddProperties().mode = modeAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); scaleOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(scaleRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); offsetOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(offsetRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); borderOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(borderRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(inputOperands, scaleOperands, offsetOperands, borderOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaResizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "mode"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getModeAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getScale(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOffset(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getBorder(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("mode"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaResizeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaResizeOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaResizeOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaReverseOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaReverseOpGenericAdaptorBase::TosaReverseOpGenericAdaptorBase(TosaReverseOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} uint32_t TosaReverseOpGenericAdaptorBase::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } } // namespace detail TosaReverseOpAdaptor::TosaReverseOpAdaptor(TosaReverseOp op) : TosaReverseOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaReverseOpAdaptor::verify(::mlir::Location loc) { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitError(loc, "'spirv.Tosa.Reverse' op requires attribute 'axis'"); if (tblgen_axis && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_axis))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_axis).getInt() <= 5)))) return emitError(loc, "'spirv.Tosa.Reverse' op attribute 'axis' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 5"); return ::mlir::success(); } ::llvm::LogicalResult TosaReverseOp::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.axis; auto attr = dict.get("axis"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `axis` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaReverseOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.axis; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("axis", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaReverseOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.axis.getAsOpaquePointer())); } std::optional TosaReverseOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "axis") return prop.axis; return std::nullopt; } void TosaReverseOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "axis") { prop.axis = ::llvm::dyn_cast_or_null>(value); return; } } void TosaReverseOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.axis) attrs.append("axis", prop.axis); } ::llvm::LogicalResult TosaReverseOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAxisAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(attr, "axis", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaReverseOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.axis))) return ::mlir::failure(); return ::mlir::success(); } void TosaReverseOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.axis); } uint32_t TosaReverseOp::getAxis() { auto attr = getAxisAttr(); return attr.getValue().getZExtValue(); } void TosaReverseOp::setAxis(uint32_t attrValue) { getProperties().axis = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue); } void TosaReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = axis; odsState.addTypes(output); } TosaReverseOp TosaReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::IntegerAttr axis, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input1)); } void TosaReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr axis, ::mlir::Value input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = axis; ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaReverseOp::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); } TosaReverseOp TosaReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr axis, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr axis, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(axis), std::forward(input1)); } void TosaReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = axis; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReverseOp TosaReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr axis, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input1)); } void TosaReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint32_t axis, ::mlir::Value input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); odsState.addTypes(output); } TosaReverseOp TosaReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, uint32_t axis, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, uint32_t axis, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(axis), std::forward(input1)); } void TosaReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t axis, ::mlir::Value input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaReverseOp::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); } TosaReverseOp TosaReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint32_t axis, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, uint32_t axis, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(axis), std::forward(input1)); } void TosaReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input1) { odsState.addOperands(input1); odsState.getOrAddProperties().axis = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), axis); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaReverseOp TosaReverseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(axis), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t axis, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(axis), std::forward(input1)); } void TosaReverseOp::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(); ::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."); } } TosaReverseOp TosaReverseOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaReverseOp::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(); ::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(TosaReverseOp::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)."); } } TosaReverseOp TosaReverseOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaReverseOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaReverseOp TosaReverseOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaReverseOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaReverseOp::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)."); } } TosaReverseOp TosaReverseOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaReverseOp TosaReverseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaReverseOp::verifyInvariantsImpl() { auto tblgen_axis = getProperties().axis; (void)tblgen_axis; if (!tblgen_axis) return emitOpError("requires attribute 'axis'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps36(*this, tblgen_axis, "axis"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps61(*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_SPIRVOps61(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((getAxis() < ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that axis attribute value should be lower than rank(input1)"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaReverseOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaReverseOp::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 TosaReverseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::IntegerAttr axisAttr; ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("axis")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(axisAttr, parser.getBuilder().getIntegerType(32))) { return ::mlir::failure(); } if (axisAttr) result.getOrAddProperties().axis = axisAttr; if (parser.parseComma()) return ::mlir::failure(); input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaReverseOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "axis"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getAxisAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("axis"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaReverseOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaReverseOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaReverseOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaRsqrtOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaRsqrtOpGenericAdaptorBase::TosaRsqrtOpGenericAdaptorBase(TosaRsqrtOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaRsqrtOpAdaptor::TosaRsqrtOpAdaptor(TosaRsqrtOp op) : TosaRsqrtOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaRsqrtOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaRsqrtOp::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 TosaRsqrtOp::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 TosaRsqrtOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaRsqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaRsqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaRsqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaRsqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaRsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaRsqrtOp TosaRsqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRsqrtOp TosaRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaRsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaRsqrtOp::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); } TosaRsqrtOp TosaRsqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRsqrtOp TosaRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaRsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaRsqrtOp TosaRsqrtOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRsqrtOp TosaRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaRsqrtOp::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); } TosaRsqrtOp TosaRsqrtOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRsqrtOp TosaRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaRsqrtOp::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(TosaRsqrtOp::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)."); } } TosaRsqrtOp TosaRsqrtOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRsqrtOp TosaRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaRsqrtOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaRsqrtOp TosaRsqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRsqrtOp TosaRsqrtOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaRsqrtOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaRsqrtOp::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)."); } } TosaRsqrtOp TosaRsqrtOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaRsqrtOp TosaRsqrtOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaRsqrtOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaRsqrtOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaRsqrtOp::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 TosaRsqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaRsqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaRsqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaRsqrtOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaScatterOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaScatterOpGenericAdaptorBase::TosaScatterOpGenericAdaptorBase(TosaScatterOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaScatterOpAdaptor::TosaScatterOpAdaptor(TosaScatterOp op) : TosaScatterOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaScatterOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaScatterOp::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 TosaScatterOp::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 TosaScatterOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaScatterOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaScatterOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaScatterOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaScatterOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaScatterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values_out, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { odsState.addOperands(values_in); odsState.addOperands(indices); odsState.addOperands(input); odsState.addTypes(values_out); } TosaScatterOp TosaScatterOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type values_out, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(values_out), std::forward(values_in), std::forward(indices), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaScatterOp TosaScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type values_out, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(values_out), std::forward(values_in), std::forward(indices), std::forward(input)); } void TosaScatterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { odsState.addOperands(values_in); odsState.addOperands(indices); odsState.addOperands(input); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaScatterOp::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); } TosaScatterOp TosaScatterOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(values_in), std::forward(indices), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaScatterOp TosaScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(values_in), std::forward(indices), std::forward(input)); } void TosaScatterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { odsState.addOperands(values_in); odsState.addOperands(indices); odsState.addOperands(input); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaScatterOp TosaScatterOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(values_in), std::forward(indices), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaScatterOp TosaScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(values_in), std::forward(indices), std::forward(input)); } void TosaScatterOp::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); } TosaScatterOp TosaScatterOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaScatterOp TosaScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaScatterOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaScatterOp::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)."); } } TosaScatterOp TosaScatterOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaScatterOp TosaScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaScatterOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaScatterOp TosaScatterOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaScatterOp TosaScatterOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaScatterOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaScatterOp::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)."); } } TosaScatterOp TosaScatterOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaScatterOp TosaScatterOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaScatterOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps77(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps78(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps77(*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_SPIRVOps77(*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->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {values_in, input, values_out} have same element type"); if (!((((*this->getODSOperands(0).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 {values_in, values_out} have same type"); if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(1)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(1)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(1) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(1)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(2)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(2) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(2)))))) return emitOpError("failed to verify that shapes of values_in, indices, and input must satisfy [N,K,C], [N,W], [N,W,C]"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaScatterOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaScatterOp::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 TosaScatterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand values_inRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> values_inOperands(&values_inRawOperand, 1); ::llvm::SMLoc values_inOperandsLoc; (void)values_inOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand indicesRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> indicesOperands(&indicesRawOperand, 1); ::llvm::SMLoc indicesOperandsLoc; (void)indicesOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; values_inOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(values_inRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); indicesOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(indicesRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(values_inOperands, indicesOperands, inputOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaScatterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getValuesIn(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getIndices(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaScatterOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaScatterOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaSelectOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaSelectOpGenericAdaptorBase::TosaSelectOpGenericAdaptorBase(TosaSelectOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaSelectOpAdaptor::TosaSelectOpAdaptor(TosaSelectOp op) : TosaSelectOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaSelectOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaSelectOp::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 TosaSelectOp::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 TosaSelectOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaSelectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaSelectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaSelectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaSelectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaSelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { odsState.addOperands(condition); odsState.addOperands(true_value); odsState.addOperands(false_value); odsState.addTypes(output); } TosaSelectOp TosaSelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(condition), std::forward(true_value), std::forward(false_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSelectOp TosaSelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { return create(builder, builder.getLoc(), std::forward(output), std::forward(condition), std::forward(true_value), std::forward(false_value)); } void TosaSelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { odsState.addOperands(condition); odsState.addOperands(true_value); odsState.addOperands(false_value); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaSelectOp TosaSelectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(condition), std::forward(true_value), std::forward(false_value)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSelectOp TosaSelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(condition), std::forward(true_value), std::forward(false_value)); } void TosaSelectOp::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); } TosaSelectOp TosaSelectOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSelectOp TosaSelectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaSelectOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaSelectOp TosaSelectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSelectOp TosaSelectOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaSelectOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps74(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps96(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps96(*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_SPIRVOps96(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin())))))) return emitOpError("failed to verify that all of {true_value, false_value, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {condition, true_value, false_value, output} have same rank"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaSelectOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult TosaSelectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand conditionRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(&conditionRawOperand, 1); ::llvm::SMLoc conditionOperandsLoc; (void)conditionOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand true_valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> true_valueOperands(&true_valueRawOperand, 1); ::llvm::SMLoc true_valueOperandsLoc; (void)true_valueOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand false_valueRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> false_valueOperands(&false_valueRawOperand, 1); ::llvm::SMLoc false_valueOperandsLoc; (void)false_valueOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; conditionOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(conditionRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); true_valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(true_valueRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); false_valueOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(false_valueRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(conditionOperands, true_valueOperands, false_valueOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaSelectOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getCondition(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getTrueValue(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getFalseValue(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaSelectOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaSelectOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaSigmoidOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaSigmoidOpGenericAdaptorBase::TosaSigmoidOpGenericAdaptorBase(TosaSigmoidOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaSigmoidOpAdaptor::TosaSigmoidOpAdaptor(TosaSigmoidOp op) : TosaSigmoidOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaSigmoidOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaSigmoidOp::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 TosaSigmoidOp::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 TosaSigmoidOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaSigmoidOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaSigmoidOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaSigmoidOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaSigmoidOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaSigmoidOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input) { odsState.addOperands(input); odsState.addTypes(output); } TosaSigmoidOp TosaSigmoidOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSigmoidOp TosaSigmoidOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input)); } void TosaSigmoidOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input) { odsState.addOperands(input); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaSigmoidOp::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); } TosaSigmoidOp TosaSigmoidOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSigmoidOp TosaSigmoidOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(input)); } void TosaSigmoidOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) { odsState.addOperands(input); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaSigmoidOp TosaSigmoidOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSigmoidOp TosaSigmoidOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input)); } void TosaSigmoidOp::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); } TosaSigmoidOp TosaSigmoidOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSigmoidOp TosaSigmoidOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaSigmoidOp::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(TosaSigmoidOp::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)."); } } TosaSigmoidOp TosaSigmoidOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSigmoidOp TosaSigmoidOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaSigmoidOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaSigmoidOp TosaSigmoidOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSigmoidOp TosaSigmoidOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaSigmoidOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaSigmoidOp::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)."); } } TosaSigmoidOp TosaSigmoidOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSigmoidOp TosaSigmoidOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaSigmoidOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaSigmoidOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaSigmoidOp::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 TosaSigmoidOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaSigmoidOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaSigmoidOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaSigmoidOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaSinOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaSinOpGenericAdaptorBase::TosaSinOpGenericAdaptorBase(TosaSinOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaSinOpAdaptor::TosaSinOpAdaptor(TosaSinOp op) : TosaSinOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaSinOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaSinOp::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 TosaSinOp::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 TosaSinOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaSinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaSinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaSinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaSinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1) { odsState.addOperands(input1); odsState.addTypes(output); } TosaSinOp TosaSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSinOp TosaSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1)); } void TosaSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1) { odsState.addOperands(input1); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaSinOp::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); } TosaSinOp TosaSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSinOp TosaSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(input1)); } void TosaSinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { odsState.addOperands(input1); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaSinOp TosaSinOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSinOp TosaSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1)); } void TosaSinOp::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); } TosaSinOp TosaSinOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSinOp TosaSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaSinOp::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(TosaSinOp::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)."); } } TosaSinOp TosaSinOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSinOp TosaSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaSinOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaSinOp TosaSinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSinOp TosaSinOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaSinOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaSinOp::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)."); } } TosaSinOp TosaSinOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSinOp TosaSinOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaSinOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input1, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaSinOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaSinOp::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 TosaSinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaSinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaSinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaSinOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaSliceOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaSliceOpGenericAdaptorBase::TosaSliceOpGenericAdaptorBase(TosaSliceOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaSliceOpAdaptor::TosaSliceOpAdaptor(TosaSliceOp op) : TosaSliceOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaSliceOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaSliceOp::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 TosaSliceOp::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 TosaSliceOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaSliceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaSliceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaSliceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaSliceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size) { odsState.addOperands(input1); odsState.addOperands(start); odsState.addOperands(size); odsState.addTypes(output); } TosaSliceOp TosaSliceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(start), std::forward(size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSliceOp TosaSliceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(start), std::forward(size)); } void TosaSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size) { odsState.addOperands(input1); odsState.addOperands(start); odsState.addOperands(size); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaSliceOp TosaSliceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(start), std::forward(size)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSliceOp TosaSliceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(start), std::forward(size)); } void TosaSliceOp::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); } TosaSliceOp TosaSliceOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSliceOp TosaSliceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaSliceOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaSliceOp TosaSliceOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSliceOp TosaSliceOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaSliceOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps61(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps91(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps91(*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_SPIRVOps61(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getNumElements() == 1 * ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that the number of elements of start must be rank(input1)"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getNumElements() == 1 * ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that the number of elements of size must be rank(input1)"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaSliceOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaSliceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand startRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> startOperands(&startRawOperand, 1); ::llvm::SMLoc startOperandsLoc; (void)startOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand sizeRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sizeOperands(&sizeRawOperand, 1); ::llvm::SMLoc sizeOperandsLoc; (void)sizeOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); startOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(startRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); sizeOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(sizeRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, startOperands, sizeOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaSliceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getStart(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getSize(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaSliceOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaSliceOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaSubOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaSubOpGenericAdaptorBase::TosaSubOpGenericAdaptorBase(TosaSubOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaSubOpAdaptor::TosaSubOpAdaptor(TosaSubOp op) : TosaSubOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaSubOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaSubOp::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 TosaSubOp::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 TosaSubOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaSubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaSubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaSubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaSubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); odsState.addTypes(output); } TosaSubOp TosaSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSubOp TosaSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(input2)); } void TosaSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { odsState.addOperands(input1); odsState.addOperands(input2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaSubOp TosaSubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(input2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSubOp TosaSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(input2)); } void TosaSubOp::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); } TosaSubOp TosaSubOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSubOp TosaSubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaSubOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaSubOp TosaSubOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaSubOp TosaSubOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaSubOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps55(*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_SPIRVOps55(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); 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 {input1, input2} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, input2, output} have same rank"); if (!((!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasRank())) && ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getRank() && ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank() == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank())))) || ((llvm::all_of_zip(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape(), ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape(), [](int64_t input1Dim, int64_t input2Dim, int64_t outputDim) { bool dynamic = ShapedType::isDynamic(input1Dim) || ShapedType::isDynamic(input2Dim) || ShapedType::isDynamic(outputDim); bool broadcastableInputs = input1Dim == input2Dim || input1Dim == 1 || input2Dim == 1; bool broacastDimMatchesOutputDim = std::max(input1Dim, input2Dim) == outputDim; return dynamic || (broadcastableInputs && broacastDimMatchesOutputDim);}))))) return emitOpError("failed to verify that the shape of input1 and input2 are compatible for broadcasting and the broadcast shape is equal to the output shape"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaSubOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaSubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input2Operands(&input2RawOperand, 1); ::llvm::SMLoc input2OperandsLoc; (void)input2OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input2RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, input2Operands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaSubOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput2(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaSubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaSubOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaTableOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaTableOpGenericAdaptorBase::TosaTableOpGenericAdaptorBase(TosaTableOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaTableOpAdaptor::TosaTableOpAdaptor(TosaTableOp op) : TosaTableOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaTableOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaTableOp::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 TosaTableOp::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 TosaTableOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaTableOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaTableOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaTableOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaTableOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaTableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value table) { odsState.addOperands(input1); odsState.addOperands(table); odsState.addTypes(output); } TosaTableOp TosaTableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value table) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(table)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTableOp TosaTableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value table) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(table)); } void TosaTableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value table) { odsState.addOperands(input1); odsState.addOperands(table); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaTableOp TosaTableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value table) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(table)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTableOp TosaTableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value table) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(table)); } void TosaTableOp::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); } TosaTableOp TosaTableOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTableOp TosaTableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaTableOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaTableOp TosaTableOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTableOp TosaTableOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaTableOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps97(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps98(*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_SPIRVOps99(*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 {input1, table} have same element type"); 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 {input1, output} have same shape"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input1 has type 8-bit signless integer then output must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))))) return emitOpError("failed to verify that if input1 has type 16-bit signless integer then output must have a type in [32-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || ((::llvm::cast<::mlir::ShapedType>(getTable().getType()).getShape()[0] == 256)))) return emitOpError("failed to verify that table must have size 256 if input1 has element type 8-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || ((::llvm::cast<::mlir::ShapedType>(getTable().getType()).getShape()[0] == 513)))) return emitOpError("failed to verify that table must have size 513 if input1 has element type 16-bit signless integer"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaTableOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaTableOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand tableRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tableOperands(&tableRawOperand, 1); ::llvm::SMLoc tableOperandsLoc; (void)tableOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); tableOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(tableRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, tableOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaTableOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getTable(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaTableOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaTableOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaTanhOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaTanhOpGenericAdaptorBase::TosaTanhOpGenericAdaptorBase(TosaTanhOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaTanhOpAdaptor::TosaTanhOpAdaptor(TosaTanhOp op) : TosaTanhOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaTanhOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaTanhOp::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 TosaTanhOp::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 TosaTanhOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaTanhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaTanhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaTanhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaTanhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input) { odsState.addOperands(input); odsState.addTypes(output); } TosaTanhOp TosaTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTanhOp TosaTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input)); } void TosaTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input) { odsState.addOperands(input); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaTanhOp::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); } TosaTanhOp TosaTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTanhOp TosaTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(input)); } void TosaTanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) { odsState.addOperands(input); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaTanhOp TosaTanhOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTanhOp TosaTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input)); } void TosaTanhOp::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); } TosaTanhOp TosaTanhOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTanhOp TosaTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaTanhOp::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(TosaTanhOp::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)."); } } TosaTanhOp TosaTanhOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTanhOp TosaTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void TosaTanhOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaTanhOp TosaTanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTanhOp TosaTanhOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void TosaTanhOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(TosaTanhOp::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)."); } } TosaTanhOp TosaTanhOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTanhOp TosaTanhOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaTanhOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps63(*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_SPIRVOps63(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((*this->getODSOperands(0).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 {input, output} have same type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaTanhOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult TosaTanhOp::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 TosaTanhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(inputOperands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaTanhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaTanhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaTanhOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaTileOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaTileOpGenericAdaptorBase::TosaTileOpGenericAdaptorBase(TosaTileOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TosaTileOpAdaptor::TosaTileOpAdaptor(TosaTileOp op) : TosaTileOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaTileOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TosaTileOp::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 TosaTileOp::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 TosaTileOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TosaTileOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TosaTileOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TosaTileOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TosaTileOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TosaTileOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value multiples) { odsState.addOperands(input1); odsState.addOperands(multiples); odsState.addTypes(output); } TosaTileOp TosaTileOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value multiples) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(input1), std::forward(multiples)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTileOp TosaTileOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value multiples) { return create(builder, builder.getLoc(), std::forward(output), std::forward(input1), std::forward(multiples)); } void TosaTileOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value multiples) { odsState.addOperands(input1); odsState.addOperands(multiples); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaTileOp TosaTileOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value multiples) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(input1), std::forward(multiples)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTileOp TosaTileOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value multiples) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(input1), std::forward(multiples)); } void TosaTileOp::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); } TosaTileOp TosaTileOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTileOp TosaTileOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaTileOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaTileOp TosaTileOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTileOp TosaTileOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaTileOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps61(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps91(*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_SPIRVOps61(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, output} have same rank"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getNumElements() == 1 * ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that the number of elements of multiples must be rank(input1)"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaTileOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaTileOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand multiplesRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> multiplesOperands(&multiplesRawOperand, 1); ::llvm::SMLoc multiplesOperandsLoc; (void)multiplesOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); multiplesOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(multiplesRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(input1Operands, multiplesOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaTileOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getInput1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getMultiples(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaTileOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaTileOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaTransposeConv2DOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaTransposeConv2DOpGenericAdaptorBase::TosaTransposeConv2DOpGenericAdaptorBase(TosaTransposeConv2DOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::DenseIntElementsAttr TosaTransposeConv2DOpGenericAdaptorBase::getOutPad() { auto attr = getOutPadAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaTransposeConv2DOpGenericAdaptorBase::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaTransposeConv2DOpGenericAdaptorBase::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } bool TosaTransposeConv2DOpGenericAdaptorBase::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } } // namespace detail TosaTransposeConv2DOpAdaptor::TosaTransposeConv2DOpAdaptor(TosaTransposeConv2DOp op) : TosaTransposeConv2DOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaTransposeConv2DOpAdaptor::verify(::mlir::Location loc) { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitError(loc, "'spirv.Tosa.TransposeConv2D' op requires attribute 'acc_type'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitError(loc, "'spirv.Tosa.TransposeConv2D' op requires attribute 'local_bound'"); auto tblgen_out_pad = getProperties().out_pad; (void)tblgen_out_pad; if (!tblgen_out_pad) return emitError(loc, "'spirv.Tosa.TransposeConv2D' op requires attribute 'out_pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitError(loc, "'spirv.Tosa.TransposeConv2D' op requires attribute 'stride'"); if (tblgen_out_pad && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_out_pad))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_out_pad).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_out_pad).getType().getShape() == ::mlir::ArrayRef({4})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_out_pad).getType()))))) return emitError(loc, "'spirv.Tosa.TransposeConv2D' op attribute 'out_pad' failed to satisfy constraint: 32-bit signless int elements attribute of shape [4] Attr with type = spirv::TensorArmType"); if (tblgen_stride && !(((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_stride))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_stride).getType().getShape() == ::mlir::ArrayRef({2})))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getType()))) && ((::llvm::all_of(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_stride).getValues<::llvm::APInt>(), [](const ::llvm::APInt &value) { return value.getSExtValue() >= 1; }))))) return emitError(loc, "'spirv.Tosa.TransposeConv2D' op attribute 'stride' failed to satisfy constraint: 32-bit signless int elements attribute of shape [2] Attr with type = spirv::TensorArmType all values must be >= 1"); if (tblgen_acc_type && !((::llvm::isa<::mlir::spirv::TosaExtAccTypeAttr>(tblgen_acc_type)))) return emitError(loc, "'spirv.Tosa.TransposeConv2D' op attribute 'acc_type' failed to satisfy constraint: Tosa Ext Acculumator Type"); if (tblgen_local_bound && !((::llvm::isa<::mlir::BoolAttr>(tblgen_local_bound)))) return emitError(loc, "'spirv.Tosa.TransposeConv2D' op attribute 'local_bound' failed to satisfy constraint: bool attribute"); return ::mlir::success(); } ::llvm::LogicalResult TosaTransposeConv2DOp::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.acc_type; auto attr = dict.get("acc_type"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `acc_type` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.local_bound; auto attr = dict.get("local_bound"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `local_bound` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.out_pad; auto attr = dict.get("out_pad"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `out_pad` in property conversion: " << attr; return ::mlir::failure(); } } } { auto &propStorage = prop.stride; auto attr = dict.get("stride"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `stride` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaTransposeConv2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.acc_type; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("acc_type", propStorage)); } { const auto &propStorage = prop.local_bound; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("local_bound", propStorage)); } { const auto &propStorage = prop.out_pad; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("out_pad", propStorage)); } { const auto &propStorage = prop.stride; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("stride", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaTransposeConv2DOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.acc_type.getAsOpaquePointer()), llvm::hash_value(prop.local_bound.getAsOpaquePointer()), llvm::hash_value(prop.out_pad.getAsOpaquePointer()), llvm::hash_value(prop.stride.getAsOpaquePointer())); } std::optional TosaTransposeConv2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "acc_type") return prop.acc_type; if (name == "local_bound") return prop.local_bound; if (name == "out_pad") return prop.out_pad; if (name == "stride") return prop.stride; return std::nullopt; } void TosaTransposeConv2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "acc_type") { prop.acc_type = ::llvm::dyn_cast_or_null>(value); return; } if (name == "local_bound") { prop.local_bound = ::llvm::dyn_cast_or_null>(value); return; } if (name == "out_pad") { prop.out_pad = ::llvm::dyn_cast_or_null>(value); return; } if (name == "stride") { prop.stride = ::llvm::dyn_cast_or_null>(value); return; } } void TosaTransposeConv2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.acc_type) attrs.append("acc_type", prop.acc_type); if (prop.local_bound) attrs.append("local_bound", prop.local_bound); if (prop.out_pad) attrs.append("out_pad", prop.out_pad); if (prop.stride) attrs.append("stride", prop.stride); } ::llvm::LogicalResult TosaTransposeConv2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getAccTypeAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(attr, "acc_type", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getLocalBoundAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(attr, "local_bound", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getOutPadAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps47(attr, "out_pad", emitError))) return ::mlir::failure(); } { ::mlir::Attribute attr = attrs.get(getStrideAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(attr, "stride", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaTransposeConv2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.acc_type))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.local_bound))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.out_pad))) return ::mlir::failure(); if (::mlir::failed(reader.readAttribute(prop.stride))) return ::mlir::failure(); return ::mlir::success(); } void TosaTransposeConv2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.acc_type); writer.writeAttribute(prop.local_bound); writer.writeAttribute(prop.out_pad); writer.writeAttribute(prop.stride); } ::mlir::DenseIntElementsAttr TosaTransposeConv2DOp::getOutPad() { auto attr = getOutPadAttr(); return attr; } ::mlir::DenseIntElementsAttr TosaTransposeConv2DOp::getStride() { auto attr = getStrideAttr(); return attr; } ::mlir::spirv::TosaExtAccType TosaTransposeConv2DOp::getAccType() { auto attr = getAccTypeAttr(); return attr.getValue(); } bool TosaTransposeConv2DOp::getLocalBound() { auto attr = getLocalBoundAttr(); return attr.getValue(); } void TosaTransposeConv2DOp::setAccType(::mlir::spirv::TosaExtAccType attrValue) { getProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void TosaTransposeConv2DOp::setLocalBound(bool attrValue) { getProperties().local_bound = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue); } void TosaTransposeConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().out_pad = out_pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().acc_type = acc_type; odsState.getOrAddProperties().local_bound = local_bound; odsState.addTypes(output); } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(out_pad), std::forward(stride), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(out_pad), std::forward(stride), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaTransposeConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().out_pad = out_pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().acc_type = acc_type; odsState.getOrAddProperties().local_bound = local_bound; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(out_pad), std::forward(stride), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccTypeAttr acc_type, ::mlir::BoolAttr local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(out_pad), std::forward(stride), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaTransposeConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().out_pad = out_pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); odsState.addTypes(output); } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(out_pad), std::forward(stride), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(output), std::forward(out_pad), std::forward(stride), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaTransposeConv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { odsState.addOperands(input); odsState.addOperands(weight); odsState.addOperands(bias); odsState.addOperands(input_zp); odsState.addOperands(weight_zp); odsState.getOrAddProperties().out_pad = out_pad; odsState.getOrAddProperties().stride = stride; odsState.getOrAddProperties().acc_type = ::mlir::spirv::TosaExtAccTypeAttr::get(odsBuilder.getContext(), acc_type); odsState.getOrAddProperties().local_bound = odsBuilder.getBoolAttr(local_bound); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(out_pad), std::forward(stride), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr out_pad, ::mlir::DenseIntElementsAttr stride, ::mlir::spirv::TosaExtAccType acc_type, bool local_bound, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(out_pad), std::forward(stride), std::forward(acc_type), std::forward(local_bound), std::forward(input), std::forward(weight), std::forward(bias), std::forward(input_zp), std::forward(weight_zp)); } void TosaTransposeConv2DOp::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(); ::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."); } } TosaTransposeConv2DOp TosaTransposeConv2DOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeConv2DOp TosaTransposeConv2DOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaTransposeConv2DOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaTransposeConv2DOp TosaTransposeConv2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeConv2DOp TosaTransposeConv2DOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaTransposeConv2DOp::verifyInvariantsImpl() { auto tblgen_acc_type = getProperties().acc_type; (void)tblgen_acc_type; if (!tblgen_acc_type) return emitOpError("requires attribute 'acc_type'"); auto tblgen_local_bound = getProperties().local_bound; (void)tblgen_local_bound; if (!tblgen_local_bound) return emitOpError("requires attribute 'local_bound'"); auto tblgen_out_pad = getProperties().out_pad; (void)tblgen_out_pad; if (!tblgen_out_pad) return emitOpError("requires attribute 'out_pad'"); auto tblgen_stride = getProperties().stride; (void)tblgen_stride; if (!tblgen_stride) return emitOpError("requires attribute 'stride'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps47(*this, tblgen_out_pad, "out_pad"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps39(*this, tblgen_stride, "stride"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps41(*this, tblgen_acc_type, "acc_type"))) return ::mlir::failure(); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps38(*this, tblgen_local_bound, "local_bound"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps59(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps67(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps68(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup3 = getODSOperands(3); for (auto v : valueGroup3) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps60(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup4 = getODSOperands(4); for (auto v : valueGroup4) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps69(*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_SPIRVOps70(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(0)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getDimSize(3) == ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(3)))) && (((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) && ((((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0)))) || ((::mlir::ShapedType::isDynamic(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == ::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getDimSize(3)))) || ((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getDimSize(0) == 1))))) return emitOpError("failed to verify that shapes of input, weight, bias, and output must satisfy [N,IH,IW,IC], [OC,KH,KW,IC], [OC/1], [N,OH,OW,OC]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(32)))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then output must have a type in [32-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(64)))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then output must have a type in [64-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSResults(0).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then output must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then output must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isF16()))))) return emitOpError("failed to verify that if input has type f8E5M2 type then output must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input has type 8-bit signless integer then weight must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isSignlessInteger(8)))))) return emitOpError("failed to verify that if input has type 16-bit signless integer then weight must have a type in [8-bit signless integer]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type bfloat16 type then weight must have a type in [bfloat16 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF16()))))) return emitOpError("failed to verify that if input has type 16-bit float then weight must have a type in [16-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF32()))))) return emitOpError("failed to verify that if input has type 32-bit float then weight must have a type in [32-bit float]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type f8E4M3FN type then weight must have a type in [f8E4M3FN type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(1).begin())))))))) return emitOpError("failed to verify that if input has type f8E5M2 type then weight must have a type in [f8E5M2 type]"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(8))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT32] when type has value 8-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(16))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::INT48}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [INT48] when type has value 16-bit signless integer"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF16())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16,::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16,FP32] when type has value 16-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::BFloat16Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value bfloat16 type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isF32())))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP32}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP32] when type has value 32-bit float"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E4M3FNType>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E4M3FN type"); if (!((!(((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::Float8E5M2Type>(getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))) || ((llvm::is_contained({::mlir::spirv::TosaExtAccType::FP16}, getAccType()))))) return emitOpError("failed to verify that acc_type must be one in [FP16] when type has value f8E5M2 type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin())))))) return emitOpError("failed to verify that all of {bias, output} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(3).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input, input_zp} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(4).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin())))))) return emitOpError("failed to verify that all of {weight, weight_zp} have same element type"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaTransposeConv2DOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult TosaTransposeConv2DOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::DenseIntElementsAttr out_padAttr; ::mlir::DenseIntElementsAttr strideAttr; ::mlir::spirv::TosaExtAccTypeAttr acc_typeAttr; ::mlir::BoolAttr local_boundAttr; ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc; (void)inputOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand weightRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> weightOperands(&weightRawOperand, 1); ::llvm::SMLoc weightOperandsLoc; (void)weightOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand biasRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> biasOperands(&biasRawOperand, 1); ::llvm::SMLoc biasOperandsLoc; (void)biasOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand input_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input_zpOperands(&input_zpRawOperand, 1); ::llvm::SMLoc input_zpOperandsLoc; (void)input_zpOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand weight_zpRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> weight_zpOperands(&weight_zpRawOperand, 1); ::llvm::SMLoc weight_zpOperandsLoc; (void)weight_zpOperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("out_pad")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, out_padAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().out_pad = out_padAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("stride")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, strideAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().stride = strideAttr; } if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("acc_type")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(acc_typeAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (acc_typeAttr) result.getOrAddProperties().acc_type = acc_typeAttr; if (parser.parseComma()) return ::mlir::failure(); if (parser.parseKeyword("local_bound")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); if (parser.parseCustomAttributeWithFallback(local_boundAttr, parser.getBuilder().getIntegerType(1))) { return ::mlir::failure(); } if (local_boundAttr) result.getOrAddProperties().local_bound = local_boundAttr; if (parser.parseComma()) return ::mlir::failure(); inputOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(inputRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); weightOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(weightRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); biasOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(biasRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); input_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input_zpRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); weight_zpOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(weight_zpRawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(::llvm::concat(inputOperands, weightOperands, biasOperands, input_zpOperands, weight_zpOperands), allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaTransposeConv2DOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "out_pad"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getOutPadAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "stride"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getStrideAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "acc_type"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getAccTypeAttr()); _odsPrinter << ","; _odsPrinter << ' ' << "local_bound"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getLocalBoundAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getWeight(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getBias(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInputZp(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getWeightZp(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("out_pad"); elidedAttrs.push_back("stride"); elidedAttrs.push_back("acc_type"); elidedAttrs.push_back("local_bound"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaTransposeConv2DOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaTransposeConv2DOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaTransposeConv2DOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TosaTransposeOp definitions //===----------------------------------------------------------------------===// namespace detail { TosaTransposeOpGenericAdaptorBase::TosaTransposeOpGenericAdaptorBase(TosaTransposeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::DenseIntElementsAttr TosaTransposeOpGenericAdaptorBase::getPerms() { auto attr = getPermsAttr(); return attr; } } // namespace detail TosaTransposeOpAdaptor::TosaTransposeOpAdaptor(TosaTransposeOp op) : TosaTransposeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TosaTransposeOpAdaptor::verify(::mlir::Location loc) { auto tblgen_perms = getProperties().perms; (void)tblgen_perms; if (!tblgen_perms) return emitError(loc, "'spirv.Tosa.Transpose' op requires attribute 'perms'"); if (tblgen_perms && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_perms))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_perms).getType().getElementType().isSignlessInteger(32)))) && ((::llvm::isa<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_perms).getType()))) && (((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_perms).getType()).getShape().size() == 1 )) && (((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_perms).getType()).getShape()[0] == 1)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_perms).getType()).getShape()[0] == 2)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_perms).getType()).getShape()[0] == 3)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_perms).getType()).getShape()[0] == 4)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_perms).getType()).getShape()[0] == 5)) || ((::llvm::cast<::mlir::spirv::TensorArmType>(::llvm::cast<::mlir::DenseElementsAttr>(tblgen_perms).getType()).getShape()[0] == 6)))))) return emitError(loc, "'spirv.Tosa.Transpose' op attribute 'perms' failed to satisfy constraint: 32-bit signless integer elements attribute Attr with type = spirv::TensorArmType "); return ::mlir::success(); } ::llvm::LogicalResult TosaTransposeOp::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.perms; auto attr = dict.get("perms"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `perms` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute TosaTransposeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.perms; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("perms", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code TosaTransposeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.perms.getAsOpaquePointer())); } std::optional TosaTransposeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "perms") return prop.perms; return std::nullopt; } void TosaTransposeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "perms") { prop.perms = ::llvm::dyn_cast_or_null>(value); return; } } void TosaTransposeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.perms) attrs.append("perms", prop.perms); } ::llvm::LogicalResult TosaTransposeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getPermsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps48(attr, "perms", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult TosaTransposeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.perms))) return ::mlir::failure(); return ::mlir::success(); } void TosaTransposeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.perms); } ::mlir::DenseIntElementsAttr TosaTransposeOp::getPerms() { auto attr = getPermsAttr(); return attr; } void TosaTransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr perms, ::mlir::Value input1) { odsState.addOperands(input1); odsState.getOrAddProperties().perms = perms; odsState.addTypes(output); } TosaTransposeOp TosaTransposeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr perms, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(output), std::forward(perms), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeOp TosaTransposeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr perms, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(output), std::forward(perms), std::forward(input1)); } void TosaTransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr perms, ::mlir::Value input1) { odsState.addOperands(input1); odsState.getOrAddProperties().perms = perms; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TosaTransposeOp TosaTransposeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr perms, ::mlir::Value input1) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(perms), std::forward(input1)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeOp TosaTransposeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr perms, ::mlir::Value input1) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(perms), std::forward(input1)); } void TosaTransposeOp::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(); ::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."); } } TosaTransposeOp TosaTransposeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeOp TosaTransposeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TosaTransposeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TosaTransposeOp TosaTransposeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TosaTransposeOp TosaTransposeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TosaTransposeOp::verifyInvariantsImpl() { auto tblgen_perms = getProperties().perms; (void)tblgen_perms; if (!tblgen_perms) return emitOpError("requires attribute 'perms'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps48(*this, tblgen_perms, "perms"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps61(*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_SPIRVOps61(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {input1, output} have same element type"); if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getRank()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that all of {input1, output} have same rank"); if (!((!(((!::mlir::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()) || !::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasStaticShape()) || (!::mlir::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()) || !::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).hasStaticShape())))) && (((llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getNumElements()) == (llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getNumElements()) && (llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getNumElements()) == (llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getNumElements()))))) return emitOpError("failed to verify that all of {input1, output} have same element count"); if (!((!((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).hasRank()))) || ((llvm::cast<::mlir::ShapedType>(getPerms().getType()).getNumElements() == 1 * ::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getRank())))) return emitOpError("failed to verify that the number of elements of perms must be rank(input1)"); if (!((isNestedInGraphARMOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a spirv.ARM.Graph op's block"); return ::mlir::success(); } ::llvm::LogicalResult TosaTransposeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TosaTransposeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::DenseIntElementsAttr permsAttr; ::mlir::OpAsmParser::UnresolvedOperand input1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> input1Operands(&input1RawOperand, 1); ::llvm::SMLoc input1OperandsLoc; (void)input1OperandsLoc; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; if (parser.parseKeyword("perms")) return ::mlir::failure(); if (parser.parseEqual()) return ::mlir::failure(); { auto odsResult = parseSPIRV_I32_1DArmTensor(parser, permsAttr); if (odsResult) return ::mlir::failure(); result.getOrAddProperties().perms = permsAttr; } if (parser.parseComma()) return ::mlir::failure(); input1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(input1RawOperand)) 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.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); if (parser.parseTypeList(allResultTypes)) return ::mlir::failure(); result.addTypes(allResultTypes); if (parser.resolveOperands(input1Operands, allOperandTypes, parser.getNameLoc(), result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TosaTransposeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' ' << "perms"; _odsPrinter << ' ' << "="; _odsPrinter << ' '; printSPIRV_I32_1DArmTensor(_odsPrinter, *this, getPermsAttr()); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getInput1(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("perms"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ' ' << "->"; _odsPrinter << ' '; _odsPrinter << getOperation()->getResultTypes(); } void TosaTransposeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TosaTransposeOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::TosaTransposeOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::TransposeOp definitions //===----------------------------------------------------------------------===// namespace detail { TransposeOpGenericAdaptorBase::TransposeOpGenericAdaptorBase(TransposeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail TransposeOpAdaptor::TransposeOpAdaptor(TransposeOp op) : TransposeOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult TransposeOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult TransposeOp::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 TransposeOp::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 TransposeOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional TransposeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void TransposeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void TransposeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult TransposeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void TransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value matrix) { odsState.addOperands(matrix); odsState.addTypes(result); } TransposeOp TransposeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value matrix) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(matrix)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TransposeOp TransposeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value matrix) { return create(builder, builder.getLoc(), std::forward(result), std::forward(matrix)); } void TransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix) { odsState.addOperands(matrix); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } TransposeOp TransposeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value matrix) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(matrix)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TransposeOp TransposeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value matrix) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(matrix)); } void TransposeOp::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); } TransposeOp TransposeOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TransposeOp TransposeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void TransposeOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } TransposeOp TransposeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } TransposeOp TransposeOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult TransposeOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps48(*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_SPIRVOps48(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {matrix, result} have same element type"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(0).begin()).getType()).getNumRows() == ::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSResults(0).begin()).getType()).getNumColumns()))) return emitOpError("failed to verify that matrix rows count matches result columns count"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(0).begin()).getType()).getNumColumns() == ::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSResults(0).begin()).getType()).getNumRows()))) return emitOpError("failed to verify that matrix columns count matches result rows count"); return ::mlir::success(); } ::llvm::LogicalResult TransposeOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult TransposeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type matrixRawType{}; ::llvm::ArrayRef<::mlir::Type> matrixTypes(&matrixRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); matrixRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, matrixTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void TransposeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getMatrix().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(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 TransposeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::TransposeOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UConvertOp definitions //===----------------------------------------------------------------------===// namespace detail { UConvertOpGenericAdaptorBase::UConvertOpGenericAdaptorBase(UConvertOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UConvertOpAdaptor::UConvertOpAdaptor(UConvertOp op) : UConvertOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UConvertOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UConvertOp::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 UConvertOp::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 UConvertOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UConvertOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UConvertOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UConvertOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UConvertOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UConvertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { odsState.addOperands(operand); odsState.addTypes(result); } UConvertOp UConvertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UConvertOp UConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand)); } void UConvertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UConvertOp UConvertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UConvertOp UConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void UConvertOp::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); } UConvertOp UConvertOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UConvertOp UConvertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UConvertOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UConvertOp UConvertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UConvertOp UConvertOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UConvertOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps14(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult UConvertOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult UConvertOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) 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(); operandRawType = type; } if (parser.parseKeyword("to")) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void UConvertOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "to"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void UConvertOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UConvertOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UDivOp definitions //===----------------------------------------------------------------------===// namespace detail { UDivOpGenericAdaptorBase::UDivOpGenericAdaptorBase(UDivOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UDivOpAdaptor::UDivOpAdaptor(UDivOp op) : UDivOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UDivOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UDivOp::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 UDivOp::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 UDivOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UDivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UDivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UDivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UDivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UDivOp::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); } UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UDivOp UDivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void UDivOp::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); } UDivOp UDivOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UDivOp::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(UDivOp::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)."); } } UDivOp UDivOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void UDivOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UDivOp UDivOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDivOp UDivOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void UDivOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UDivOp::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)."); } } UDivOp UDivOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDivOp UDivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UDivOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps14(*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_SPIRVOps14(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult UDivOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult UDivOp::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 UDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void UDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 UDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UDivOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UDotAccSatOp definitions //===----------------------------------------------------------------------===// namespace detail { UDotAccSatOpGenericAdaptorBase::UDotAccSatOpGenericAdaptorBase(UDotAccSatOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::PackedVectorFormat> UDotAccSatOpGenericAdaptorBase::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } } // namespace detail UDotAccSatOpAdaptor::UDotAccSatOpAdaptor(UDotAccSatOp op) : UDotAccSatOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UDotAccSatOpAdaptor::verify(::mlir::Location loc) { auto tblgen_format = getProperties().format; (void)tblgen_format; if (tblgen_format && !((::llvm::isa<::mlir::spirv::PackedVectorFormatAttr>(tblgen_format)))) return emitError(loc, "'spirv.UDotAccSat' op attribute 'format' failed to satisfy constraint: valid SPIR-V PackedVectorFormat"); return ::mlir::success(); } ::llvm::LogicalResult UDotAccSatOp::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.format; auto attr = dict.get("format"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `format` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute UDotAccSatOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.format; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("format", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code UDotAccSatOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.format.getAsOpaquePointer())); } std::optional UDotAccSatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "format") return prop.format; return std::nullopt; } void UDotAccSatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "format") { prop.format = ::llvm::dyn_cast_or_null>(value); return; } } void UDotAccSatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.format) attrs.append("format", prop.format); } ::llvm::LogicalResult UDotAccSatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getFormatAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(attr, "format", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult UDotAccSatOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.format))) return ::mlir::failure(); return ::mlir::success(); } void UDotAccSatOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.format); } ::std::optional<::mlir::spirv::PackedVectorFormat> UDotAccSatOp::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } void UDotAccSatOp::setFormat(::std::optional<::mlir::spirv::PackedVectorFormat> attrValue) { auto &odsProp = getProperties().format; if (attrValue) odsProp = ::mlir::spirv::PackedVectorFormatAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void UDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } odsState.addTypes(result); } UDotAccSatOp UDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotAccSatOp UDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void UDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UDotAccSatOp::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); } UDotAccSatOp UDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotAccSatOp UDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void UDotAccSatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.addOperands(accumulator); if (format) { odsState.getOrAddProperties().format = format; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UDotAccSatOp UDotAccSatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotAccSatOp UDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::Value accumulator, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(accumulator), std::forward(format)); } void UDotAccSatOp::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(); ::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."); } } UDotAccSatOp UDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotAccSatOp UDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UDotAccSatOp::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(); ::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(UDotAccSatOp::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)."); } } UDotAccSatOp UDotAccSatOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotAccSatOp UDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void UDotAccSatOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UDotAccSatOp UDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotAccSatOp UDotAccSatOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void UDotAccSatOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UDotAccSatOp::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)."); } } UDotAccSatOp UDotAccSatOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotAccSatOp UDotAccSatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UDotAccSatOp::verifyInvariantsImpl() { auto tblgen_format = getProperties().format; (void)tblgen_format; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(*this, tblgen_format, "format"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps5(*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->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that all of {vector1, vector2} have same type"); 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 {accumulator, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult UDotAccSatOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult UDotAccSatOp::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 UDotAccSatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vector1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector1Operands(&vector1RawOperand, 1); ::llvm::SMLoc vector1OperandsLoc; (void)vector1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand vector2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector2Operands(&vector2RawOperand, 1); ::llvm::SMLoc vector2OperandsLoc; (void)vector2OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand accumulatorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accumulatorOperands(&accumulatorRawOperand, 1); ::llvm::SMLoc accumulatorOperandsLoc; (void)accumulatorOperandsLoc; ::mlir::spirv::PackedVectorFormatAttr formatAttr; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); vector1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); vector2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector2RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); accumulatorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(accumulatorRawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(formatAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (formatAttr) result.getOrAddProperties().format = formatAttr; } { 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(); vector1RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(vector1Operands, vector1Types, vector1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(vector2Operands, vector1Types[0], vector2OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(accumulatorOperands, resultTypes[0], accumulatorOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void UDotAccSatOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getVector2(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getAccumulator(); if (getFormatAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getFormatAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("format"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void UDotAccSatOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UDotAccSatOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::UDotAccSatOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UDotOp definitions //===----------------------------------------------------------------------===// namespace detail { UDotOpGenericAdaptorBase::UDotOpGenericAdaptorBase(UDotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::std::optional<::mlir::spirv::PackedVectorFormat> UDotOpGenericAdaptorBase::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } } // namespace detail UDotOpAdaptor::UDotOpAdaptor(UDotOp op) : UDotOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UDotOpAdaptor::verify(::mlir::Location loc) { auto tblgen_format = getProperties().format; (void)tblgen_format; if (tblgen_format && !((::llvm::isa<::mlir::spirv::PackedVectorFormatAttr>(tblgen_format)))) return emitError(loc, "'spirv.UDot' op attribute 'format' failed to satisfy constraint: valid SPIR-V PackedVectorFormat"); return ::mlir::success(); } ::llvm::LogicalResult UDotOp::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.format; auto attr = dict.get("format"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `format` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute UDotOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.format; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("format", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code UDotOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.format.getAsOpaquePointer())); } std::optional UDotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "format") return prop.format; return std::nullopt; } void UDotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "format") { prop.format = ::llvm::dyn_cast_or_null>(value); return; } } void UDotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.format) attrs.append("format", prop.format); } ::llvm::LogicalResult UDotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getFormatAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(attr, "format", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult UDotOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readOptionalAttribute(prop.format))) return ::mlir::failure(); return ::mlir::success(); } void UDotOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeOptionalAttribute(prop.format); } ::std::optional<::mlir::spirv::PackedVectorFormat> UDotOp::getFormat() { auto attr = getFormatAttr(); return attr ? ::std::optional<::mlir::spirv::PackedVectorFormat>(attr.getValue()) : (::std::nullopt); } void UDotOp::setFormat(::std::optional<::mlir::spirv::PackedVectorFormat> attrValue) { auto &odsProp = getProperties().format; if (attrValue) odsProp = ::mlir::spirv::PackedVectorFormatAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue); else odsProp = nullptr; } void UDotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); if (format) { odsState.getOrAddProperties().format = format; } odsState.addTypes(result); } UDotOp UDotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotOp UDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(format)); } void UDotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { odsState.addOperands(vector1); odsState.addOperands(vector2); if (format) { odsState.getOrAddProperties().format = format; } assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UDotOp UDotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(format)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotOp UDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, /*optional*/::mlir::spirv::PackedVectorFormatAttr format) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(format)); } void UDotOp::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(); ::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."); } } UDotOp UDotOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotOp UDotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UDotOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UDotOp UDotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UDotOp UDotOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UDotOp::verifyInvariantsImpl() { auto tblgen_format = getProperties().format; (void)tblgen_format; if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps31(*this, tblgen_format, "format"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps5(*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->getODSOperands(0).begin()).getType())))) return emitOpError("failed to verify that all of {vector1, vector2} have same type"); return ::mlir::success(); } ::llvm::LogicalResult UDotOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult UDotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vector1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector1Operands(&vector1RawOperand, 1); ::llvm::SMLoc vector1OperandsLoc; (void)vector1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand vector2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector2Operands(&vector2RawOperand, 1); ::llvm::SMLoc vector2OperandsLoc; (void)vector2OperandsLoc; ::mlir::spirv::PackedVectorFormatAttr formatAttr; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); vector1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); vector2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector2RawOperand)) return ::mlir::failure(); if (::mlir::succeeded(parser.parseOptionalComma())) { if (parser.parseCustomAttributeWithFallback(formatAttr, ::mlir::Type{})) { return ::mlir::failure(); } if (formatAttr) result.getOrAddProperties().format = formatAttr; } { 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(); vector1RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(vector1Operands, vector1Types, vector1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(vector2Operands, vector1Types[0], vector2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void UDotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getVector2(); if (getFormatAttr()) { _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter.printStrippedAttrOrType(getFormatAttr()); } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("format"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void UDotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UDotOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::UDotOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UGreaterThanEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { UGreaterThanEqualOpGenericAdaptorBase::UGreaterThanEqualOpGenericAdaptorBase(UGreaterThanEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UGreaterThanEqualOpAdaptor::UGreaterThanEqualOpAdaptor(UGreaterThanEqualOp op) : UGreaterThanEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UGreaterThanEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UGreaterThanEqualOp::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 UGreaterThanEqualOp::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 UGreaterThanEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UGreaterThanEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UGreaterThanEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UGreaterThanEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UGreaterThanEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void UGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UGreaterThanEqualOp::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); } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void UGreaterThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void UGreaterThanEqualOp::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); } UGreaterThanEqualOp UGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UGreaterThanEqualOp::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(UGreaterThanEqualOp::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)."); } } UGreaterThanEqualOp UGreaterThanEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void UGreaterThanEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UGreaterThanEqualOp UGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanEqualOp UGreaterThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void UGreaterThanEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UGreaterThanEqualOp::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)."); } } UGreaterThanEqualOp UGreaterThanEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanEqualOp UGreaterThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UGreaterThanEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult UGreaterThanEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult UGreaterThanEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult UGreaterThanEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void UGreaterThanEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void UGreaterThanEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UGreaterThanEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UGreaterThanOp definitions //===----------------------------------------------------------------------===// namespace detail { UGreaterThanOpGenericAdaptorBase::UGreaterThanOpGenericAdaptorBase(UGreaterThanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UGreaterThanOpAdaptor::UGreaterThanOpAdaptor(UGreaterThanOp op) : UGreaterThanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UGreaterThanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UGreaterThanOp::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 UGreaterThanOp::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 UGreaterThanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UGreaterThanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UGreaterThanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UGreaterThanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UGreaterThanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } UGreaterThanOp UGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanOp UGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void UGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UGreaterThanOp::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); } UGreaterThanOp UGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanOp UGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void UGreaterThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UGreaterThanOp UGreaterThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanOp UGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void UGreaterThanOp::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); } UGreaterThanOp UGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanOp UGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UGreaterThanOp::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(UGreaterThanOp::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)."); } } UGreaterThanOp UGreaterThanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanOp UGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void UGreaterThanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UGreaterThanOp UGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanOp UGreaterThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void UGreaterThanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UGreaterThanOp::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)."); } } UGreaterThanOp UGreaterThanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UGreaterThanOp UGreaterThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UGreaterThanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult UGreaterThanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult UGreaterThanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult UGreaterThanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void UGreaterThanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void UGreaterThanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UGreaterThanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ULessThanEqualOp definitions //===----------------------------------------------------------------------===// namespace detail { ULessThanEqualOpGenericAdaptorBase::ULessThanEqualOpGenericAdaptorBase(ULessThanEqualOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ULessThanEqualOpAdaptor::ULessThanEqualOpAdaptor(ULessThanEqualOp op) : ULessThanEqualOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ULessThanEqualOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ULessThanEqualOp::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 ULessThanEqualOp::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 ULessThanEqualOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ULessThanEqualOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ULessThanEqualOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ULessThanEqualOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ULessThanEqualOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ULessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } ULessThanEqualOp ULessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanEqualOp ULessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void ULessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ULessThanEqualOp::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); } ULessThanEqualOp ULessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanEqualOp ULessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void ULessThanEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ULessThanEqualOp ULessThanEqualOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanEqualOp ULessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void ULessThanEqualOp::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); } ULessThanEqualOp ULessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanEqualOp ULessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ULessThanEqualOp::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(ULessThanEqualOp::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)."); } } ULessThanEqualOp ULessThanEqualOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanEqualOp ULessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void ULessThanEqualOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ULessThanEqualOp ULessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanEqualOp ULessThanEqualOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void ULessThanEqualOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ULessThanEqualOp::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)."); } } ULessThanEqualOp ULessThanEqualOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanEqualOp ULessThanEqualOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ULessThanEqualOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult ULessThanEqualOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult ULessThanEqualOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult ULessThanEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ULessThanEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void ULessThanEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ULessThanEqualOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::ULessThanOp definitions //===----------------------------------------------------------------------===// namespace detail { ULessThanOpGenericAdaptorBase::ULessThanOpGenericAdaptorBase(ULessThanOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail ULessThanOpAdaptor::ULessThanOpAdaptor(ULessThanOp op) : ULessThanOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult ULessThanOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult ULessThanOp::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 ULessThanOp::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 ULessThanOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional ULessThanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void ULessThanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void ULessThanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult ULessThanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void ULessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } ULessThanOp ULessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanOp ULessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void ULessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ULessThanOp::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); } ULessThanOp ULessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanOp ULessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void ULessThanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } ULessThanOp ULessThanOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanOp ULessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void ULessThanOp::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); } ULessThanOp ULessThanOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanOp ULessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void ULessThanOp::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(ULessThanOp::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)."); } } ULessThanOp ULessThanOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanOp ULessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void ULessThanOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } ULessThanOp ULessThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanOp ULessThanOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void ULessThanOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(ULessThanOp::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)."); } } ULessThanOp ULessThanOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } ULessThanOp ULessThanOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult ULessThanOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult ULessThanOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult ULessThanOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult ULessThanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isInteger(8))) || ((type.isInteger(16))) || ((type.isInteger(32))) || ((type.isInteger(64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 8/16/32/64-bit integer or fixed-length vector of 8/16/32/64-bit integer values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void ULessThanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void ULessThanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::ULessThanOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UModOp definitions //===----------------------------------------------------------------------===// namespace detail { UModOpGenericAdaptorBase::UModOpGenericAdaptorBase(UModOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UModOpAdaptor::UModOpAdaptor(UModOp op) : UModOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UModOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UModOp::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 UModOp::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 UModOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UModOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UModOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UModOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UModOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } UModOp UModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UModOp UModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void UModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UModOp::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); } UModOp UModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UModOp UModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void UModOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UModOp UModOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UModOp UModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void UModOp::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); } UModOp UModOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UModOp UModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UModOp::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(UModOp::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)."); } } UModOp UModOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UModOp UModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void UModOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UModOp UModOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UModOp UModOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void UModOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UModOp::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)."); } } UModOp UModOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UModOp UModOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UModOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps7(*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 {operand1, operand2, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult UModOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult UModOp::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 UModOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void UModOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 UModOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UModOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UMulExtendedOp definitions //===----------------------------------------------------------------------===// namespace detail { UMulExtendedOpGenericAdaptorBase::UMulExtendedOpGenericAdaptorBase(UMulExtendedOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UMulExtendedOpAdaptor::UMulExtendedOpAdaptor(UMulExtendedOp op) : UMulExtendedOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UMulExtendedOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UMulExtendedOp::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 UMulExtendedOp::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 UMulExtendedOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UMulExtendedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UMulExtendedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UMulExtendedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UMulExtendedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UMulExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value operand1, Value operand2) { build(odsBuilder, odsState, ::mlir::spirv::StructType::get({operand1.getType(), operand1.getType()}), operand1, operand2); } UMulExtendedOp UMulExtendedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value operand1, Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UMulExtendedOp UMulExtendedOp::create(::mlir::ImplicitLocOpBuilder &builder, Value operand1, Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void UMulExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } UMulExtendedOp UMulExtendedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UMulExtendedOp UMulExtendedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void UMulExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UMulExtendedOp UMulExtendedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UMulExtendedOp UMulExtendedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void UMulExtendedOp::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); } UMulExtendedOp UMulExtendedOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UMulExtendedOp UMulExtendedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UMulExtendedOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UMulExtendedOp UMulExtendedOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UMulExtendedOp UMulExtendedOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UMulExtendedOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps7(*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_SPIRVOps25(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult UMulExtendedOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult UMulExtendedOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } void UMulExtendedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UMulExtendedOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UndefOp definitions //===----------------------------------------------------------------------===// namespace detail { UndefOpGenericAdaptorBase::UndefOpGenericAdaptorBase(UndefOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UndefOpAdaptor::UndefOpAdaptor(UndefOp op) : UndefOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UndefOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UndefOp::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 UndefOp::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 UndefOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UndefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UndefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UndefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UndefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { odsState.addTypes(result); } UndefOp UndefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UndefOp UndefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result) { return create(builder, builder.getLoc(), std::forward(result)); } void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UndefOp UndefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UndefOp UndefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) { return create(builder, builder.getLoc(), std::forward(resultTypes)); } void UndefOp::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() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UndefOp UndefOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UndefOp UndefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UndefOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UndefOp UndefOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UndefOp UndefOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UndefOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSResults(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps12(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult UndefOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult UndefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); return ::mlir::success(); } void UndefOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _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 UndefOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UndefOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UnorderedOp definitions //===----------------------------------------------------------------------===// namespace detail { UnorderedOpGenericAdaptorBase::UnorderedOpGenericAdaptorBase(UnorderedOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UnorderedOpAdaptor::UnorderedOpAdaptor(UnorderedOp op) : UnorderedOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UnorderedOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UnorderedOp::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 UnorderedOp::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 UnorderedOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UnorderedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UnorderedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UnorderedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UnorderedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UnorderedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); odsState.addTypes(result); } UnorderedOp UnorderedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnorderedOp UnorderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(result), std::forward(operand1), std::forward(operand2)); } void UnorderedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UnorderedOp::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); } UnorderedOp UnorderedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnorderedOp UnorderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(operand1), std::forward(operand2)); } void UnorderedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { odsState.addOperands(operand1); odsState.addOperands(operand2); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } UnorderedOp UnorderedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnorderedOp UnorderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand1, ::mlir::Value operand2) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand1), std::forward(operand2)); } void UnorderedOp::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); } UnorderedOp UnorderedOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnorderedOp UnorderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UnorderedOp::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(UnorderedOp::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)."); } } UnorderedOp UnorderedOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnorderedOp UnorderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void UnorderedOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UnorderedOp UnorderedOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnorderedOp UnorderedOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void UnorderedOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(UnorderedOp::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)."); } } UnorderedOp UnorderedOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnorderedOp UnorderedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UnorderedOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps10(*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_SPIRVOps22(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(getMatchingBoolType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of result to correspond to the `i1` equivalent of the operand"); return ::mlir::success(); } ::llvm::LogicalResult UnorderedOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult UnorderedOp::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 = getMatchingBoolType(operands[0].getType()); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult UnorderedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operand1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand1Operands(&operand1RawOperand, 1); ::llvm::SMLoc operand1OperandsLoc; (void)operand1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand operand2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operand2Operands(&operand2RawOperand, 1); ::llvm::SMLoc operand2OperandsLoc; (void)operand2OperandsLoc; ::mlir::Type operand1RawType{}; ::llvm::ArrayRef<::mlir::Type> operand1Types(&operand1RawType, 1); operand1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); operand2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operand2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operand1RawType = type; } { 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(); } for (::mlir::Type type : operand1Types) { (void)type; if (!((((type.isF16())) || ((type.isF32())) || ((type.isF64()))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && (((::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() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16))))))) { return parser.emitError(parser.getNameLoc()) << "'operand1' must be 16/32/64-bit float or fixed-length vector of 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(getMatchingBoolType(operand1Types[0])); if (parser.resolveOperands(operand1Operands, operand1Types, operand1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(operand2Operands, operand1Types[0], operand2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void UnorderedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperand1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getOperand2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } void UnorderedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UnorderedOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::UnreachableOp definitions //===----------------------------------------------------------------------===// namespace detail { UnreachableOpGenericAdaptorBase::UnreachableOpGenericAdaptorBase(UnreachableOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail UnreachableOpAdaptor::UnreachableOpAdaptor(UnreachableOp op) : UnreachableOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult UnreachableOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult UnreachableOp::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 UnreachableOp::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 UnreachableOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional UnreachableOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void UnreachableOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void UnreachableOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult UnreachableOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void UnreachableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { } UnreachableOp UnreachableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnreachableOp UnreachableOp::create(::mlir::ImplicitLocOpBuilder &builder) { return create(builder, builder.getLoc()); } void UnreachableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } UnreachableOp UnreachableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnreachableOp UnreachableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) { return create(builder, builder.getLoc(), std::forward(resultTypes)); } void UnreachableOp::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); } UnreachableOp UnreachableOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnreachableOp UnreachableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void UnreachableOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } UnreachableOp UnreachableOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } UnreachableOp UnreachableOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult UnreachableOp::verifyInvariantsImpl() { if (!((isNestedInFunctionOpInterface((*this->getOperation()).getParentOp())))) return emitOpError("failed to verify that op must appear in a function-like op's block"); return ::mlir::success(); } ::llvm::LogicalResult UnreachableOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult UnreachableOp::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 UnreachableOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::UnreachableOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::VariableOp definitions //===----------------------------------------------------------------------===// namespace detail { VariableOpGenericAdaptorBase::VariableOpGenericAdaptorBase(VariableOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} std::pair VariableOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { bool isVariadic[] = {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 - 0) / 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::spirv::StorageClass VariableOpGenericAdaptorBase::getStorageClass() { auto attr = getStorageClassAttr(); return attr.getValue(); } } // namespace detail VariableOpAdaptor::VariableOpAdaptor(VariableOp op) : VariableOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult VariableOpAdaptor::verify(::mlir::Location loc) { auto tblgen_storage_class = getProperties().storage_class; (void)tblgen_storage_class; if (!tblgen_storage_class) return emitError(loc, "'spirv.Variable' op requires attribute 'storage_class'"); if (tblgen_storage_class && !((::llvm::isa<::mlir::spirv::StorageClassAttr>(tblgen_storage_class)))) return emitError(loc, "'spirv.Variable' op attribute 'storage_class' failed to satisfy constraint: valid SPIR-V StorageClass"); return ::mlir::success(); } std::pair VariableOp::getODSOperandIndexAndLength(unsigned index) { bool isVariadic[] = {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() - 0) / 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 VariableOp::getInitializerMutable() { auto range = getODSOperandIndexAndLength(0); auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); return mutableRange; } ::llvm::LogicalResult VariableOp::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.storage_class; auto attr = dict.get("storage_class"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `storage_class` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute VariableOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.storage_class; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("storage_class", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code VariableOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.storage_class.getAsOpaquePointer())); } std::optional VariableOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "storage_class") return prop.storage_class; return std::nullopt; } void VariableOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "storage_class") { prop.storage_class = ::llvm::dyn_cast_or_null>(value); return; } } void VariableOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.storage_class) attrs.append("storage_class", prop.storage_class); } ::llvm::LogicalResult VariableOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getStorageClassAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps49(attr, "storage_class", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult VariableOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.storage_class))) return ::mlir::failure(); return ::mlir::success(); } void VariableOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.storage_class); } ::mlir::spirv::StorageClass VariableOp::getStorageClass() { auto attr = getStorageClassAttr(); return attr.getValue(); } void VariableOp::setStorageClass(::mlir::spirv::StorageClass attrValue) { getProperties().storage_class = ::mlir::spirv::StorageClassAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue); } void VariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type pointer, ::mlir::spirv::StorageClassAttr storage_class, /*optional*/::mlir::Value initializer) { if (initializer) odsState.addOperands(initializer); odsState.getOrAddProperties().storage_class = storage_class; odsState.addTypes(pointer); } VariableOp VariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type pointer, ::mlir::spirv::StorageClassAttr storage_class, /*optional*/::mlir::Value initializer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(storage_class), std::forward(initializer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type pointer, ::mlir::spirv::StorageClassAttr storage_class, /*optional*/::mlir::Value initializer) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(storage_class), std::forward(initializer)); } void VariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::StorageClassAttr storage_class, /*optional*/::mlir::Value initializer) { if (initializer) odsState.addOperands(initializer); odsState.getOrAddProperties().storage_class = storage_class; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } VariableOp VariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::StorageClassAttr storage_class, /*optional*/::mlir::Value initializer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(storage_class), std::forward(initializer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::StorageClassAttr storage_class, /*optional*/::mlir::Value initializer) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(storage_class), std::forward(initializer)); } void VariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type pointer, ::mlir::spirv::StorageClass storage_class, /*optional*/::mlir::Value initializer) { if (initializer) odsState.addOperands(initializer); odsState.getOrAddProperties().storage_class = ::mlir::spirv::StorageClassAttr::get(odsBuilder.getContext(), storage_class); odsState.addTypes(pointer); } VariableOp VariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type pointer, ::mlir::spirv::StorageClass storage_class, /*optional*/::mlir::Value initializer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(pointer), std::forward(storage_class), std::forward(initializer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type pointer, ::mlir::spirv::StorageClass storage_class, /*optional*/::mlir::Value initializer) { return create(builder, builder.getLoc(), std::forward(pointer), std::forward(storage_class), std::forward(initializer)); } void VariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::spirv::StorageClass storage_class, /*optional*/::mlir::Value initializer) { if (initializer) odsState.addOperands(initializer); odsState.getOrAddProperties().storage_class = ::mlir::spirv::StorageClassAttr::get(odsBuilder.getContext(), storage_class); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } VariableOp VariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::spirv::StorageClass storage_class, /*optional*/::mlir::Value initializer) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(storage_class), std::forward(initializer)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::spirv::StorageClass storage_class, /*optional*/::mlir::Value initializer) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(storage_class), std::forward(initializer)); } void VariableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { odsState.addOperands(operands); odsState.addAttributes(attributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); if (!attributes.empty()) { (void)odsState.getOrAddProperties(); ::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."); } } VariableOp VariableOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void VariableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { odsState.addOperands(operands); odsState.useProperties(const_cast(properties)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } VariableOp VariableOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VariableOp VariableOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult VariableOp::verifyInvariantsImpl() { auto tblgen_storage_class = getProperties().storage_class; (void)tblgen_storage_class; if (!tblgen_storage_class) return emitOpError("requires attribute 'storage_class'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps49(*this, tblgen_storage_class, "storage_class"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); if (valueGroup0.size() > 1) { return emitOpError("operand group starting at #") << index << " requires 0 or 1 element, but found " << valueGroup0.size(); } for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps20(*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_SPIRVOps1(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult VariableOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::llvm::LogicalResult VariableOp::setPropertiesFromParsedAttr(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(); } // keep track of used keys in the input dictionary to be able to error out // if there are some unknown ones. ::mlir::DenseSet<::mlir::StringAttr> usedKeys; ::mlir::MLIRContext *ctx = dict.getContext(); (void)ctx; { auto &propStorage = prop.storage_class; auto storage_classAttrName = ::mlir::StringAttr::get(ctx, "storage_class"); auto attr = dict.get(storage_classAttrName); usedKeys.insert(storage_classAttrName); if (attr || /*isRequired=*/true) { if (!attr) { emitError() << "expected key entry for storage_class in DictionaryAttr to set " "Properties."; return ::mlir::failure(); } auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `storage_class` in property conversion: " << attr; return ::mlir::failure(); } } } for (::mlir::NamedAttribute attr : dict) { if (!usedKeys.contains(attr.getName())) return emitError() << "unknown key '" << attr.getName() << "' when parsing properties dictionary"; } return ::mlir::success(); } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::VariableOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::VariableOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::VectorExtractDynamicOp definitions //===----------------------------------------------------------------------===// namespace detail { VectorExtractDynamicOpGenericAdaptorBase::VectorExtractDynamicOpGenericAdaptorBase(VectorExtractDynamicOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail VectorExtractDynamicOpAdaptor::VectorExtractDynamicOpAdaptor(VectorExtractDynamicOp op) : VectorExtractDynamicOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult VectorExtractDynamicOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult VectorExtractDynamicOp::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 VectorExtractDynamicOp::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 VectorExtractDynamicOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional VectorExtractDynamicOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void VectorExtractDynamicOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void VectorExtractDynamicOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult VectorExtractDynamicOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void VectorExtractDynamicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value index) { odsState.addOperands(vector); odsState.addOperands(index); odsState.addTypes(result); } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value index) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector), std::forward(index)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value index) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector), std::forward(index)); } void VectorExtractDynamicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value index) { odsState.addOperands(vector); odsState.addOperands(index); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(VectorExtractDynamicOp::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); } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector, ::mlir::Value index) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(vector), std::forward(index)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector, ::mlir::Value index) { return create(builder, builder.getLoc(), std::forward(vector), std::forward(index)); } void VectorExtractDynamicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value index) { odsState.addOperands(vector); odsState.addOperands(index); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value index) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector), std::forward(index)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value index) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector), std::forward(index)); } void VectorExtractDynamicOp::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); } VectorExtractDynamicOp VectorExtractDynamicOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void VectorExtractDynamicOp::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(VectorExtractDynamicOp::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)."); } } VectorExtractDynamicOp VectorExtractDynamicOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void VectorExtractDynamicOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } VectorExtractDynamicOp VectorExtractDynamicOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorExtractDynamicOp VectorExtractDynamicOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void VectorExtractDynamicOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(VectorExtractDynamicOp::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)."); } } VectorExtractDynamicOp VectorExtractDynamicOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorExtractDynamicOp VectorExtractDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult VectorExtractDynamicOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps100(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps101(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType())))) return emitOpError("failed to verify that type of 'result' matches element type of 'vector'"); return ::mlir::success(); } ::llvm::LogicalResult VectorExtractDynamicOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult VectorExtractDynamicOp::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 = ::llvm::cast(operands[0].getType()).getElementType(); inferredReturnTypes[0] = odsInferredType0; return ::mlir::success(); } ::mlir::ParseResult VectorExtractDynamicOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand vectorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(&vectorRawOperand, 1); ::llvm::SMLoc vectorOperandsLoc; (void)vectorOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand indexRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> indexOperands(&indexRawOperand, 1); ::llvm::SMLoc indexOperandsLoc; (void)indexOperandsLoc; ::mlir::Type vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> vectorTypes(&vectorRawType, 1); ::mlir::Type indexRawType{}; ::llvm::ArrayRef<::mlir::Type> indexTypes(&indexRawType, 1); vectorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vectorRawOperand)) return ::mlir::failure(); if (parser.parseLSquare()) return ::mlir::failure(); indexOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(indexRawOperand)) 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::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); vectorRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); indexRawType = type; } for (::mlir::Type type : vectorTypes) { (void)type; if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16)))))) { return parser.emitError(parser.getNameLoc()) << "'vector' must be vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(::llvm::cast(vectorTypes[0]).getElementType()); if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(indexOperands, indexTypes, indexOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void VectorExtractDynamicOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getVector(); _odsPrinter << "["; _odsPrinter << getIndex(); _odsPrinter << "]"; ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getIndex().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void VectorExtractDynamicOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::VectorExtractDynamicOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::VectorInsertDynamicOp definitions //===----------------------------------------------------------------------===// namespace detail { VectorInsertDynamicOpGenericAdaptorBase::VectorInsertDynamicOpGenericAdaptorBase(VectorInsertDynamicOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail VectorInsertDynamicOpAdaptor::VectorInsertDynamicOpAdaptor(VectorInsertDynamicOp op) : VectorInsertDynamicOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult VectorInsertDynamicOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult VectorInsertDynamicOp::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 VectorInsertDynamicOp::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 VectorInsertDynamicOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional VectorInsertDynamicOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void VectorInsertDynamicOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void VectorInsertDynamicOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult VectorInsertDynamicOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void VectorInsertDynamicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { odsState.addOperands(vector); odsState.addOperands(component); odsState.addOperands(index); odsState.addTypes(result); } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector), std::forward(component), std::forward(index)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector), std::forward(component), std::forward(index)); } void VectorInsertDynamicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { odsState.addOperands(vector); odsState.addOperands(component); odsState.addOperands(index); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(VectorInsertDynamicOp::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); } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(vector), std::forward(component), std::forward(index)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { return create(builder, builder.getLoc(), std::forward(vector), std::forward(component), std::forward(index)); } void VectorInsertDynamicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { odsState.addOperands(vector); odsState.addOperands(component); odsState.addOperands(index); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector), std::forward(component), std::forward(index)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value component, ::mlir::Value index) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector), std::forward(component), std::forward(index)); } void VectorInsertDynamicOp::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); } VectorInsertDynamicOp VectorInsertDynamicOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void VectorInsertDynamicOp::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); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(VectorInsertDynamicOp::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)."); } } VectorInsertDynamicOp VectorInsertDynamicOp::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(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(attributes)); } void VectorInsertDynamicOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } VectorInsertDynamicOp VectorInsertDynamicOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorInsertDynamicOp VectorInsertDynamicOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } void VectorInsertDynamicOp::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)); odsState.addAttributes(discardableAttributes); ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; if (::mlir::succeeded(VectorInsertDynamicOp::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)."); } } VectorInsertDynamicOp VectorInsertDynamicOp::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(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorInsertDynamicOp VectorInsertDynamicOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) { return create(builder, builder.getLoc(), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult VectorInsertDynamicOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps100(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps101(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup2 = getODSOperands(2); for (auto v : valueGroup2) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps5(*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_SPIRVOps100(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSOperands(1).begin()).getType())))) return emitOpError("failed to verify that type of 'component' matches element type of 'vector'"); if (!((((*this->getODSOperands(0).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 {vector, result} have same type"); return ::mlir::success(); } ::llvm::LogicalResult VectorInsertDynamicOp::verifyInvariants() { return verifyInvariantsImpl(); } ::llvm::LogicalResult VectorInsertDynamicOp::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 VectorInsertDynamicOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand componentRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(&componentRawOperand, 1); ::llvm::SMLoc componentOperandsLoc; (void)componentOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand vectorRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(&vectorRawOperand, 1); ::llvm::SMLoc vectorOperandsLoc; (void)vectorOperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand indexRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> indexOperands(&indexRawOperand, 1); ::llvm::SMLoc indexOperandsLoc; (void)indexOperandsLoc; ::mlir::Type vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> vectorTypes(&vectorRawType, 1); ::mlir::Type indexRawType{}; ::llvm::ArrayRef<::mlir::Type> indexTypes(&indexRawType, 1); componentOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(componentRawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); vectorOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vectorRawOperand)) return ::mlir::failure(); if (parser.parseLSquare()) return ::mlir::failure(); indexOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(indexRawOperand)) 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::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); vectorRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::IntegerType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); indexRawType = type; } for (::mlir::Type type : vectorTypes) { (void)type; if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() == 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(1))) || (((elementType.isInteger(8))) || ((elementType.isInteger(16))) || ((elementType.isInteger(32))) || ((elementType.isInteger(64)))) || (((elementType.isF16())) || ((elementType.isF32())) || ((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() == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() == 16)))))) { return parser.emitError(parser.getNameLoc()) << "'vector' must be vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 of ranks 1, but got " << type; } } result.addTypes(vectorTypes[0]); if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(componentOperands, ::llvm::cast(vectorTypes[0]).getElementType(), componentOperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(indexOperands, indexTypes, indexOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void VectorInsertDynamicOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getComponent(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getVector(); _odsPrinter << "["; _odsPrinter << getIndex(); _odsPrinter << "]"; ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getIndex().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void VectorInsertDynamicOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::VectorInsertDynamicOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::VectorShuffleOp definitions //===----------------------------------------------------------------------===// namespace detail { VectorShuffleOpGenericAdaptorBase::VectorShuffleOpGenericAdaptorBase(VectorShuffleOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} ::mlir::ArrayAttr VectorShuffleOpGenericAdaptorBase::getComponents() { auto attr = getComponentsAttr(); return attr; } } // namespace detail VectorShuffleOpAdaptor::VectorShuffleOpAdaptor(VectorShuffleOp op) : VectorShuffleOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult VectorShuffleOpAdaptor::verify(::mlir::Location loc) { auto tblgen_components = getProperties().components; (void)tblgen_components; if (!tblgen_components) return emitError(loc, "'spirv.VectorShuffle' op requires attribute 'components'"); if (tblgen_components && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_components))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_components), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) return emitError(loc, "'spirv.VectorShuffle' op attribute 'components' failed to satisfy constraint: 32-bit integer array attribute"); return ::mlir::success(); } ::llvm::LogicalResult VectorShuffleOp::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.components; auto attr = dict.get("components"); if (attr) { auto convertedAttr = ::llvm::dyn_cast>(attr); if (convertedAttr) { propStorage = convertedAttr; } else { emitError() << "Invalid attribute `components` in property conversion: " << attr; return ::mlir::failure(); } } } return ::mlir::success(); } ::mlir::Attribute VectorShuffleOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { ::mlir::SmallVector<::mlir::NamedAttribute> attrs; ::mlir::Builder odsBuilder{ctx}; { const auto &propStorage = prop.components; if (propStorage) attrs.push_back(odsBuilder.getNamedAttr("components", propStorage)); } if (!attrs.empty()) return odsBuilder.getDictionaryAttr(attrs); return {}; } llvm::hash_code VectorShuffleOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine( llvm::hash_value(prop.components.getAsOpaquePointer())); } std::optional VectorShuffleOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { if (name == "components") return prop.components; return std::nullopt; } void VectorShuffleOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { if (name == "components") { prop.components = ::llvm::dyn_cast_or_null>(value); return; } } void VectorShuffleOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { if (prop.components) attrs.append("components", prop.components); } ::llvm::LogicalResult VectorShuffleOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { { ::mlir::Attribute attr = attrs.get(getComponentsAttrName(opName)); if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(attr, "components", emitError))) return ::mlir::failure(); } return ::mlir::success(); } ::llvm::LogicalResult VectorShuffleOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { auto &prop = state.getOrAddProperties(); (void)prop; if (::mlir::failed(reader.readAttribute(prop.components))) return ::mlir::failure(); return ::mlir::success(); } void VectorShuffleOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { auto &prop = getProperties(); (void)prop; writer.writeAttribute(prop.components); } ::mlir::ArrayAttr VectorShuffleOp::getComponents() { auto attr = getComponentsAttr(); return attr; } void VectorShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::ArrayAttr components) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.getOrAddProperties().components = components; odsState.addTypes(result); } VectorShuffleOp VectorShuffleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::ArrayAttr components) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(components)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorShuffleOp VectorShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::ArrayAttr components) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector1), std::forward(vector2), std::forward(components)); } void VectorShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::ArrayAttr components) { odsState.addOperands(vector1); odsState.addOperands(vector2); odsState.getOrAddProperties().components = components; assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } VectorShuffleOp VectorShuffleOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::ArrayAttr components) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(components)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorShuffleOp VectorShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector1, ::mlir::Value vector2, ::mlir::ArrayAttr components) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector1), std::forward(vector2), std::forward(components)); } void VectorShuffleOp::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(); ::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."); } } VectorShuffleOp VectorShuffleOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorShuffleOp VectorShuffleOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void VectorShuffleOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } VectorShuffleOp VectorShuffleOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorShuffleOp VectorShuffleOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult VectorShuffleOp::verifyInvariantsImpl() { auto tblgen_components = getProperties().components; (void)tblgen_components; if (!tblgen_components) return emitOpError("requires attribute 'components'"); if (::mlir::failed(__mlir_ods_local_attr_constraint_SPIRVOps4(*this, tblgen_components, "components"))) return ::mlir::failure(); { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps100(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps100(*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_SPIRVOps100(*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->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {vector1, vector2, result} have same element type"); return ::mlir::success(); } ::llvm::LogicalResult VectorShuffleOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult VectorShuffleOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::ArrayAttr componentsAttr; ::mlir::OpAsmParser::UnresolvedOperand vector1RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector1Operands(&vector1RawOperand, 1); ::llvm::SMLoc vector1OperandsLoc; (void)vector1OperandsLoc; ::mlir::OpAsmParser::UnresolvedOperand vector2RawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vector2Operands(&vector2RawOperand, 1); ::llvm::SMLoc vector2OperandsLoc; (void)vector2OperandsLoc; ::mlir::Type vector1RawType{}; ::llvm::ArrayRef<::mlir::Type> vector1Types(&vector1RawType, 1); ::mlir::Type vector2RawType{}; ::llvm::ArrayRef<::mlir::Type> vector2Types(&vector2RawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 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(); } if (parser.parseCustomAttributeWithFallback(componentsAttr, parser.getBuilder().getType<::mlir::NoneType>())) { return ::mlir::failure(); } if (componentsAttr) result.getOrAddProperties().components = componentsAttr; vector1OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector1RawOperand)) return ::mlir::failure(); if (parser.parseComma()) return ::mlir::failure(); vector2OperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(vector2RawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); vector1RawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); vector2RawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(vector1Operands, vector1Types, vector1OperandsLoc, result.operands)) return ::mlir::failure(); if (parser.resolveOperands(vector2Operands, vector2Types, vector2OperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void VectorShuffleOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; elidedAttrs.push_back("components"); _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter.printAttributeWithoutType(getComponentsAttr()); _odsPrinter << ' '; _odsPrinter << getVector1(); _odsPrinter << ","; _odsPrinter << ' '; _odsPrinter << getVector2(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector1().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getVector2().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void VectorShuffleOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::VectorShuffleOp) MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::detail::VectorShuffleOpGenericAdaptorBase::Properties) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::VectorTimesMatrixOp definitions //===----------------------------------------------------------------------===// namespace detail { VectorTimesMatrixOpGenericAdaptorBase::VectorTimesMatrixOpGenericAdaptorBase(VectorTimesMatrixOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail VectorTimesMatrixOpAdaptor::VectorTimesMatrixOpAdaptor(VectorTimesMatrixOp op) : VectorTimesMatrixOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult VectorTimesMatrixOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult VectorTimesMatrixOp::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 VectorTimesMatrixOp::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 VectorTimesMatrixOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional VectorTimesMatrixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void VectorTimesMatrixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void VectorTimesMatrixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult VectorTimesMatrixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void VectorTimesMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value matrix) { odsState.addOperands(vector); odsState.addOperands(matrix); odsState.addTypes(result); } VectorTimesMatrixOp VectorTimesMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value matrix) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector), std::forward(matrix)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorTimesMatrixOp VectorTimesMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value matrix) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector), std::forward(matrix)); } void VectorTimesMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value matrix) { odsState.addOperands(vector); odsState.addOperands(matrix); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } VectorTimesMatrixOp VectorTimesMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value matrix) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector), std::forward(matrix)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorTimesMatrixOp VectorTimesMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value matrix) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector), std::forward(matrix)); } void VectorTimesMatrixOp::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); } VectorTimesMatrixOp VectorTimesMatrixOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorTimesMatrixOp VectorTimesMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void VectorTimesMatrixOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } VectorTimesMatrixOp VectorTimesMatrixOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorTimesMatrixOp VectorTimesMatrixOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult VectorTimesMatrixOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps51(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps50(*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_SPIRVOps51(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) return emitOpError("failed to verify that all of {vector, result} have same element type"); if (!(((getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin())))))) return emitOpError("failed to verify that all of {matrix, result} have same element type"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(1).begin()).getType()).getNumRows() == ::llvm::cast<::mlir::VectorType>((*this->getODSOperands(0).begin()).getType()).getNumElements()))) return emitOpError("failed to verify that matrix rows count matches vector elements count"); if (!((::llvm::cast<::mlir::spirv::MatrixType>((*this->getODSOperands(1).begin()).getType()).getNumColumns() == ::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getNumElements()))) return emitOpError("failed to verify that matrix columns count matches result elements count"); return ::mlir::success(); } ::llvm::LogicalResult VectorTimesMatrixOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult VectorTimesMatrixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::mlir::Type vectorRawType{}; ::llvm::ArrayRef<::mlir::Type> vectorTypes(&vectorRawType, 1); ::mlir::Type matrixRawType{}; ::llvm::ArrayRef<::mlir::Type> matrixTypes(&matrixRawType, 1); ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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(); vectorRawType = type; } if (parser.parseComma()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); matrixRawType = type; } if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(vectorTypes), ::llvm::ArrayRef<::mlir::Type>(matrixTypes)), allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void VectorTimesMatrixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getVector().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ","; _odsPrinter << ' '; { auto type = getMatrix().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void VectorTimesMatrixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::VectorTimesMatrixOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::VectorTimesScalarOp definitions //===----------------------------------------------------------------------===// namespace detail { VectorTimesScalarOpGenericAdaptorBase::VectorTimesScalarOpGenericAdaptorBase(VectorTimesScalarOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail VectorTimesScalarOpAdaptor::VectorTimesScalarOpAdaptor(VectorTimesScalarOp op) : VectorTimesScalarOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult VectorTimesScalarOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult VectorTimesScalarOp::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 VectorTimesScalarOp::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 VectorTimesScalarOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional VectorTimesScalarOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void VectorTimesScalarOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void VectorTimesScalarOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult VectorTimesScalarOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void VectorTimesScalarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value scalar) { odsState.addOperands(vector); odsState.addOperands(scalar); odsState.addTypes(result); } VectorTimesScalarOp VectorTimesScalarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value scalar) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(result), std::forward(vector), std::forward(scalar)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorTimesScalarOp VectorTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value scalar) { return create(builder, builder.getLoc(), std::forward(result), std::forward(vector), std::forward(scalar)); } void VectorTimesScalarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value scalar) { odsState.addOperands(vector); odsState.addOperands(scalar); assert(resultTypes.size() == 1u && "mismatched number of results"); odsState.addTypes(resultTypes); } VectorTimesScalarOp VectorTimesScalarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value scalar) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(vector), std::forward(scalar)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorTimesScalarOp VectorTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value scalar) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(vector), std::forward(scalar)); } void VectorTimesScalarOp::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); } VectorTimesScalarOp VectorTimesScalarOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorTimesScalarOp VectorTimesScalarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void VectorTimesScalarOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 1u && "mismatched number of return types"); odsState.addTypes(resultTypes); } VectorTimesScalarOp VectorTimesScalarOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } VectorTimesScalarOp VectorTimesScalarOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult VectorTimesScalarOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps102(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } auto valueGroup1 = getODSOperands(1); for (auto v : valueGroup1) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps17(*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_SPIRVOps102(*this, v.getType(), "result", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult VectorTimesScalarOp::verifyInvariants() { if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) return ::mlir::success(); return ::mlir::failure(); } ::mlir::ParseResult VectorTimesScalarOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; ::mlir::Type resultRawType{}; ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1); [[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); if (parser.parseOperandList(allOperands)) 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.parseLParen()) return ::mlir::failure(); if (parser.parseTypeList(allOperandTypes)) return ::mlir::failure(); if (parser.parseRParen()) return ::mlir::failure(); if (parser.parseArrow()) return ::mlir::failure(); { ::mlir::VectorType type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); resultRawType = type; } result.addTypes(resultTypes); if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void VectorTimesScalarOp::print(::mlir::OpAsmPrinter &_odsPrinter) { _odsPrinter << ' '; _odsPrinter << getOperation()->getOperands(); ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' ' << ":"; _odsPrinter << ' ' << "("; _odsPrinter << getOperation()->getOperandTypes(); _odsPrinter << ")"; _odsPrinter << ' ' << "->"; _odsPrinter << ' '; { auto type = getResult().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void VectorTimesScalarOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::VectorTimesScalarOp) namespace mlir::spirv { //===----------------------------------------------------------------------===// // ::mlir::spirv::YieldOp definitions //===----------------------------------------------------------------------===// namespace detail { YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(YieldOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {} } // namespace detail YieldOpAdaptor::YieldOpAdaptor(YieldOp op) : YieldOpGenericAdaptor(op->getOperands(), op) {} ::llvm::LogicalResult YieldOpAdaptor::verify(::mlir::Location loc) { return ::mlir::success(); } ::llvm::LogicalResult YieldOp::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 YieldOp::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 YieldOp::computePropertiesHash(const Properties &prop) { using llvm::hash_value; return llvm::hash_combine(); } std::optional YieldOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { return std::nullopt; } void YieldOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { } void YieldOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { } ::llvm::LogicalResult YieldOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { return ::mlir::success(); } void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { odsState.addOperands(operand); } YieldOp YieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } YieldOp YieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(operand)); } void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { odsState.addOperands(operand); assert(resultTypes.size() == 0u && "mismatched number of results"); odsState.addTypes(resultTypes); } YieldOp YieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, std::forward(resultTypes), std::forward(operand)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } YieldOp YieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operand)); } void YieldOp::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); } YieldOp YieldOp::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(resultTypes), std::forward(operands), std::forward(attributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } YieldOp YieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { return create(builder, builder.getLoc(), std::forward(resultTypes), std::forward(operands), std::forward(attributes)); } void YieldOp::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)); odsState.addAttributes(discardableAttributes); assert(resultTypes.size() == 0u && "mismatched number of return types"); odsState.addTypes(resultTypes); } YieldOp YieldOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); auto __res__ = ::llvm::dyn_cast(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } YieldOp YieldOp::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(resultTypes), std::forward(operands), std::forward(properties), std::forward(discardableAttributes)); } ::llvm::LogicalResult YieldOp::verifyInvariantsImpl() { { unsigned index = 0; (void)index; auto valueGroup0 = getODSOperands(0); for (auto v : valueGroup0) { if (::mlir::failed(__mlir_ods_local_type_constraint_SPIRVOps20(*this, v.getType(), "operand", index++))) return ::mlir::failure(); } } return ::mlir::success(); } ::llvm::LogicalResult YieldOp::verifyInvariants() { return verifyInvariantsImpl(); } ::mlir::ParseResult YieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { ::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{}; ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc; (void)operandOperandsLoc; ::mlir::Type operandRawType{}; ::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 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(); } operandOperandsLoc = parser.getCurrentLocation(); if (parser.parseOperand(operandRawOperand)) return ::mlir::failure(); if (parser.parseColon()) return ::mlir::failure(); { ::mlir::Type type; if (parser.parseCustomTypeWithFallback(type)) return ::mlir::failure(); operandRawType = type; } if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) return ::mlir::failure(); return ::mlir::success(); } void YieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) { ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); _odsPrinter << ' '; _odsPrinter << getOperand(); _odsPrinter << ' ' << ":"; _odsPrinter << ' '; { auto type = getOperand().getType(); if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) _odsPrinter.printStrippedAttrOrType(validType); else _odsPrinter << type; } } void YieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { } } // namespace mlir::spirv MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::spirv::YieldOp) #endif // GET_OP_CLASSES