9#ifndef MLIR_DIALECT_TOSA_TRANSFORMS_TOSAPROFILECOMPILANCE_H
10#define MLIR_DIALECT_TOSA_TRANSFORMS_TOSAPROFILECOMPILANCE_H
12#include <unordered_map>
40 std::pair<SmallVector<TypeInfo>, SpecificationVersion>;
52 std::unordered_map<std::string, SmallVector<OpComplianceInfo<Profile>>>;
54 std::unordered_map<std::string, SmallVector<OpComplianceInfo<Extension>>>;
63 if (failed(populatationDispatch(op)))
64 op->
emitOpError() <<
"fail to populate the profile info\n";
67 void addType(
Type t) { tyInfo.push_back(convertTypeToInfo(t)); }
76 TypeInfo convertValueToInfo(Value value) {
80 LogicalResult populatationDispatch(Operation *op);
87 LogicalResult populateProfileInfo(T op) {
88 return op->emitOpError()
89 <<
"profile requirement for this op has not been defined";
93 LogicalResult populateProfileInfoConv(T op);
97 LogicalResult populateProfileInfoDataLayout(T op);
100 SmallVector<TypeInfo> tyInfo;
112 template <
typename T>
113 std::unordered_map<std::string, SmallVector<OpComplianceInfo<T>>>
125 template <
typename T>
136 template <
typename T>
142 case Extension::int16:
143 case Extension::int4:
144 case Extension::doubleround:
145 case Extension::inexactround:
146 return {Profile::pro_int};
147 case Extension::bf16:
148 case Extension::fp8e4m3:
149 case Extension::fp8e5m2:
151 case Extension::mxfp:
152 return {Profile::pro_fp};
153 case Extension::variable:
154 case Extension::controlflow:
155 case Extension::dynamic:
156 case Extension::int64:
157 return {Profile::pro_fp, Profile::pro_int};
158 case Extension::none:
161 llvm_unreachable(
"bad Extension type");
165 template <
typename T>
168 template <
typename T>
175 template <
typename T>
176 FailureOr<OpComplianceInfo<T>> getOperatorDefinition(
Operation *op);
std::unordered_map< std::string, SmallVector< OpComplianceInfo< Profile > > > OperationProfileComplianceMap
std::pair< SmallVector< TypeInfo >, SpecificationVersion > VersionedTypeInfo
std::unordered_map< std::string, SmallVector< OpComplianceInfo< Extension > > > OperationExtensionComplianceMap
ProfileInfoDepot(Operation *op)
SmallVector< TypeInfo > getInfo()
bool isSameTypeInfo(TypeInfo a, TypeInfo b)
LogicalResult checkProfile(Operation *op, const tosa::TargetEnv &targetEnv)
SmallVector< Profile > getCooperativeProfiles(Extension ext)
OpComplianceInfo< T > findMatchedEntry(Operation *op, SmallVector< OpComplianceInfo< T > > compInfo)
LogicalResult checkExtension(Operation *op, const tosa::TargetEnv &targetEnv)
LogicalResult checkInvalid(Operation *op)
SmallVector< StringRef > stringifyProfile(ArrayRef< T > profiles)
LogicalResult checkProfileOrExtension(Operation *op, const tosa::TargetEnv &targetEnv, const SmallVector< ArrayRef< T > > &specDefinedProfileSet)
static llvm::SmallString< 7 > stringifyTypeInfo(const TypeInfo &typeInfo)
std::unordered_map< std::string, SmallVector< OpComplianceInfo< T > > > getProfileComplianceMap()
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...
Type getType() const
Return the type of this value.
This class represents the capability enabled in the target implementation such as profile,...
unsigned getBitWidth(Type type)
Include the generated interface declarations.
Type getElementTypeOrSelf(Type type)
Return the element type or return the type itself.
SmallVector< VersionedTypeInfo > operandTypeInfoSet