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)); }
80 LogicalResult populatationDispatch(
Operation *op);
86 LogicalResult populateProfileInfo(T op) {
87 return op->emitOpError()
88 <<
"profile requirement for this op has not been defined";
92 LogicalResult populateProfileInfoConv(T op);
96 LogicalResult populateProfileInfoDataLayout(T op);
111 template <
typename T>
112 std::unordered_map<std::string, SmallVector<OpComplianceInfo<T>>>
122 LogicalResult checkInvalid(
Operation *op);
124 template <
typename T>
125 LogicalResult checkProfileOrExtension(
135 template <
typename T>
141 case Extension::int16:
142 case Extension::int4:
143 case Extension::doubleround:
144 case Extension::inexactround:
145 return {Profile::pro_int};
146 case Extension::bf16:
147 case Extension::fp8e4m3:
148 case Extension::fp8e5m2:
150 return {Profile::pro_fp};
151 case Extension::variable:
152 case Extension::controlflow:
153 case Extension::dynamic:
154 return {Profile::pro_fp, Profile::pro_int};
155 case Extension::none:
158 llvm_unreachable(
"bad Extension type");
162 template <
typename T>
165 template <
typename T>
172 template <
typename T>
173 FailureOr<OpComplianceInfo<T>> getOperatorDefinition(
Operation *op);
std::pair< SmallVector< TypeInfo >, SpecificationVersion > VersionedTypeInfo
std::unordered_map< std::string, SmallVector< OpComplianceInfo< Profile > >> OperationProfileComplianceMap
std::unordered_map< std::string, SmallVector< OpComplianceInfo< Extension > >> OperationExtensionComplianceMap
ProfileInfoDepot(Operation *op)
SmallVector< TypeInfo > getInfo()
SmallVector< Profile > getCooperativeProfiles(Extension ext)
bool isSameTypeInfo(TypeInfo a, TypeInfo b)
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.
unsigned getIntOrFloatBitWidth() const
Return the bit width of an integer or a float type, assert failure on other types.
This class provides an abstraction over the different types of ranges over Values.
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,...
Include the generated interface declarations.
Type getElementTypeOrSelf(Type type)
Return the element type or return the type itself.
SmallVector< VersionedTypeInfo > operandTypeInfoSet