9#ifndef MLIR_DIALECT_TOSA_TRANSFORMS_TOSAPROFILECOMPILANCE_H
10#define MLIR_DIALECT_TOSA_TRANSFORMS_TOSAPROFILECOMPILANCE_H
12#include <initializer_list>
13#include <unordered_map>
62 SpecificationVersion version);
97 std::unordered_map<std::string, SmallVector<OpComplianceInfo<Profile>>>;
99 std::unordered_map<std::string, SmallVector<OpComplianceInfo<Extension>>>;
108 if (failed(populatationDispatch(op)))
109 op->
emitOpError() <<
"fail to populate the profile info\n";
118 if (
auto blockScaledTy = dyn_cast<tosa::BlockScaledType>(type)) {
119 Type valueTy = blockScaledTy.getValueType();
120 Type scaleTy = blockScaledTy.getScaleType();
122 scaleTy.
getTypeID(), blockScaledTy.getBlockShape()};
127 TypeInfo convertValueToInfo(Value value) {
131 LogicalResult populatationDispatch(Operation *op);
137 template <
typename T>
138 LogicalResult populateProfileInfo(T op) {
139 return op->emitOpError()
140 <<
"profile requirement for this op has not been defined";
143 template <
typename T>
144 LogicalResult populateProfileInfoConv(T op);
147 template <
typename T>
148 LogicalResult populateProfileInfoDataLayout(T op);
151 SmallVector<TypeInfo> tyInfo;
163 template <
typename T>
164 std::unordered_map<std::string, SmallVector<OpComplianceInfo<T>>>
176 template <
typename T>
188 template <
typename T>
193 template <
typename T>
196 template <
typename T>
203 template <
typename T>
204 FailureOr<SmallVector<OpComplianceInfo<T>>>
205 getOperatorMatchedEntries(
Operation *op);
Operation is the basic unit of execution within MLIR.
InFlightDiagnostic emitOpError(const Twine &message={})
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.
This class provides an efficient unique identifier for a specific C++ type.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
TypeID getTypeID()
Return a unique identifier for the concrete type.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
ProfileInfoDepot(Operation *op)
SmallVector< TypeInfo > getInfo()
This class represents the capability enabled in the target implementation such as profile,...
static llvm::SmallString< 32 > stringifyTypeInfo(const TypeInfo &typeInfo)
LogicalResult checkExtension(Operation *op, const tosa::TargetEnv &targetEnv)
LogicalResult checkInvalid(Operation *op)
std::unordered_map< std::string, SmallVector< OpComplianceInfo< T > > > getProfileComplianceMap()
SmallVector< OpComplianceInfo< T > > findMatchedEntries(Operation *op, SmallVector< OpComplianceInfo< T > > compInfo)
LogicalResult checkProfileOrExtension(Operation *op, const tosa::TargetEnv &targetEnv)
LogicalResult checkProfile(Operation *op, const tosa::TargetEnv &targetEnv)
SmallVector< StringRef > stringifyProfile(ArrayRef< T > profiles)
bool isSameTypeInfo(TypeInfo a, TypeInfo b)
std::unordered_map< std::string, SmallVector< OpComplianceInfo< Extension > > > OperationExtensionComplianceMap
unsigned getBitWidth(Type type)
std::unordered_map< std::string, SmallVector< OpComplianceInfo< Profile > > > OperationProfileComplianceMap
Include the generated interface declarations.
Type getElementTypeOrSelf(Type type)
Return the element type or return the type itself.
OpComplianceInfo & operator=(OpComplianceInfo &&other)
OpComplianceInfo(const OpComplianceInfo &other)
SmallVector< VersionedTypeInfo > operandTypeInfoSet
OpComplianceInfo(OpComplianceInfo &&other)
OpComplianceInfo()=default
OpComplianceInfo & operator=(const OpComplianceInfo &other)
TypeInfoRef(const TypeInfo &info)
TypeInfo(mlir::TypeID typeID, uint32_t bitWidth)
std::optional< tosa::BlockShape > blockShape
TypeInfo(mlir::TypeID typeID, uint32_t bitWidth, mlir::TypeID valueTypeID, mlir::TypeID scaleTypeID, tosa::BlockShape blockShape)
SmallVector< TypeInfo > first
VersionedTypeInfo(VersionedTypeInfo &&other)
VersionedTypeInfo(const VersionedTypeInfo &other)
SpecificationVersion second
VersionedTypeInfo & operator=(const VersionedTypeInfo &other)
VersionedTypeInfo & operator=(VersionedTypeInfo &&other)
VersionedTypeInfo()=default