[Mlir-commits] [mlir] [mlir][spirv] Lower mapped TOSA custom ops to ExperimentalML.Call (PR #202581)

Igor Wodiany llvmlistbot at llvm.org
Tue Jun 9 05:23:51 PDT 2026


================
@@ -19,8 +19,44 @@
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
 #include "mlir/IR/TypeUtilities.h"
 #include "mlir/Transforms/DialectConversion.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/CommandLine.h"
 
 #include <algorithm>
+#include <string>
+#include <utility>
+
+namespace llvm::cl {
+template <>
+class parser<std::pair<std::string, int32_t>>
+    : public basic_parser<std::pair<std::string, int32_t>> {
+public:
+  parser(Option &option) : basic_parser(option) {}
+
+  bool parse(Option &option, StringRef argName, StringRef arg,
+             std::pair<std::string, int32_t> &value) {
+    auto [domain, opcodeString] = arg.rsplit(":");
+    if (domain.empty() || opcodeString.empty())
+      return option.error("expected <domain>:<opcode>", argName);
+
+    int32_t opcode;
+    if (opcodeString.getAsInteger(0, opcode))
+      return option.error("invalid opcode in custom op domain mapping",
+                          argName);
+
+    value = {domain.str(), opcode};
+    return false;
----------------
IgWod wrote:

Should it return something like `success()` or is it actually `false` that's expected?

https://github.com/llvm/llvm-project/pull/202581


More information about the Mlir-commits mailing list