10 #include "llvm/Support/FormatVariadic.h" 
   21   case Profile::pro_int:
 
   27   llvm_unreachable(
"Unknown TOSA profile");
 
   32   case Extension::int16:
 
   35   case Extension::fp8e4m3:
 
   36   case Extension::fp8e5m2:
 
   38   case Extension::variable:
 
   39   case Extension::controlflow:
 
   40   case Extension::doubleround:
 
   41   case Extension::inexactround:
 
   42   case Extension::dynamic:
 
   45   case Extension::int64:
 
   50   llvm_unreachable(
"Unknown TOSA extension");
 
   59   llvm_unreachable(
"Unknown TOSA level");
 
   68   return TargetEnv(targetAttr.getSpecificationVersion(), targetAttr.getLevel(),
 
   69                    targetAttr.getProfiles(), targetAttr.getExtensions());
 
   76   const auto isCompatibleWithTargetVersion =
 
   77       [&](
const auto &targetEnum, 
Location targetAttrLoc,
 
   78           StringRef enumName) -> LogicalResult {
 
   83              << 
" '" << stringifyEnum(targetEnum)
 
   84              << 
"' is not compatible with the target version " 
   86              << 
", minimum required version is " 
   91   for (
const auto &profile : targetAttr.getProfiles())
 
   93             isCompatibleWithTargetVersion(profile, targetAttrLoc, 
"profile")))
 
   95   for (
const auto &extension : targetAttr.getExtensions())
 
   96     if (
failed(isCompatibleWithTargetVersion(extension, targetAttrLoc,
 
   99   if (
failed(isCompatibleWithTargetVersion(targetAttr.getLevel(), targetAttrLoc,
 
  112     if (
auto attr = op->
getAttrOfType<TargetEnvAttr>(TargetEnvAttr::name))
 
  123                             {Profile::pro_int, Profile::pro_fp}, {});
 
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
MLIRContext is the top-level object for a collection of MLIR operations.
Operation is the basic unit of execution within MLIR.
AttrClass getAttrOfType(StringAttr name)
MLIRContext * getContext()
Return the context this operation is associated with.
Operation * getParentOp()
Returns the closest surrounding operation that contains this operation or nullptr if this is a top-le...
static Operation * getNearestSymbolTable(Operation *from)
Returns the nearest symbol table from a given operation from.
static FailureOr< TargetEnv > createTargetEnvFromAttr(TargetEnvAttr targetAttr, Location targetEnvAttrLoc)
static LogicalResult verifyTargetInformation(TargetEnvAttr targetAttr, Location targetAttrLoc)
A thin wrapper around the SpecificationVersion enum to represent and provide utilities around the TOS...
bool isBackwardsCompatibleWith(TosaSpecificationVersion baseVersion) const
uint32_t getMinor() const
uint32_t getMajor() const
llvm::SmallString< 4 > stringifyVersion(TosaSpecificationVersion version)
TargetEnvAttr getDefaultTargetEnv(MLIRContext *context)
TosaSpecificationVersion getMinVersion(const Profile &profile)
TargetEnvAttr lookupTargetEnv(Operation *op)
TargetEnvAttr lookupTargetEnvOrDefault(Operation *op)
Queries the target environment recursively from enclosing symbol table ops containing the given op or...
Include the generated interface declarations.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...