22 #define GEN_PASS_DEF_TOSAATTACHTARGET
23 #include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
27 class TosaAttachTarget
28 :
public tosa::impl::TosaAttachTargetBase<TosaAttachTarget> {
32 void runOnOperation()
override {
34 if (!profiles.empty()) {
35 for (
const std::string &prof : profiles) {
36 std::optional<Profile> profSymbol = symbolizeProfile(prof);
39 llvm::errs() << buildUnkownParameterErrorMessage(allProfiles,
41 return signalPassFailure();
43 selectedProfiles.push_back(profSymbol.value());
48 if (!extensions.empty()) {
49 for (
const std::string &ext : extensions) {
50 std::optional<Extension> extSymbol = symbolizeExtension(ext);
53 ExtensionAttr::getAllValues();
54 llvm::errs() << buildUnkownParameterErrorMessage(allExtensions,
56 return signalPassFailure();
58 selectedExtensions.push_back(extSymbol.value());
62 ModuleOp mod = getOperation();
64 const auto targetEnvAttr =
66 mod->setAttr(TargetEnvAttr::name, targetEnvAttr);
73 std::string unknownArgument) {
75 llvm::raw_string_ostream os(message);
76 os <<
"Unknown TOSA " << enumName <<
" name passed in '" << unknownArgument
77 <<
"', supported " << enumName <<
"s are: ";
78 llvm::interleaveComma(enumValues, os);
static MLIRContext * getContext(OpFoldResult val)
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...