@@ -1106,13 +1106,18 @@ class PropertiesSectionReader {
11061106 dialectReader.withEncodingReader (reader).readBlob (rawProperties)))
11071107 return failure ();
11081108 }
1109+
1110+ // If the op is a "fallback" op, give it a handle to the raw properties
1111+ // buffer.
1112+ if (auto *iface = opName->getInterface <FallbackBytecodeOpInterface>())
1113+ return iface->readPropertiesBlob (rawProperties, opState);
1114+
11091115 // Setup a new reader to read from the `rawProperties` sub-buffer.
11101116 EncodingReader reader (
11111117 StringRef (rawProperties.begin (), rawProperties.size ()), fileLoc);
11121118 DialectReader propReader = dialectReader.withEncodingReader (reader);
11131119
1114- auto *iface = opName->getInterface <BytecodeOpInterface>();
1115- if (iface)
1120+ if (auto *iface = opName->getInterface <BytecodeOpInterface>())
11161121 return iface->readProperties (propReader, opState);
11171122 if (opName->isRegistered ())
11181123 return propReader.emitError (
@@ -1506,7 +1511,7 @@ class mlir::BytecodeReader::Impl {
15061511 UseListOrderStorage (bool isIndexPairEncoding,
15071512 SmallVector<unsigned , 4 > &&indices)
15081513 : indices(std::move(indices)),
1509- isIndexPairEncoding (isIndexPairEncoding){};
1514+ isIndexPairEncoding (isIndexPairEncoding) {};
15101515 // / The vector containing the information required to reorder the
15111516 // / use-list of a value.
15121517 SmallVector<unsigned , 4 > indices;
@@ -1863,10 +1868,18 @@ BytecodeReader::Impl::parseOpName(EncodingReader &reader,
18631868 // Load the dialect and its version.
18641869 DialectReader dialectReader (attrTypeReader, stringReader, resourceReader,
18651870 dialectsMap, reader, version);
1866- if (failed (opName->dialect ->load (dialectReader, getContext ())))
1871+ if (succeeded (opName->dialect ->load (dialectReader, getContext ()))) {
1872+ opName->opName .emplace (
1873+ (opName->dialect ->name + " ." + opName->name ).str (), getContext ());
1874+ } else if (auto fallbackOp =
1875+ opName->dialect ->interface ->getFallbackOperationName ();
1876+ succeeded (fallbackOp)) {
1877+ // If the dialect's bytecode interface specifies a fallback op, we want
1878+ // to use that instead of an unregistered op.
1879+ opName->opName .emplace (*fallbackOp);
1880+ } else {
18671881 return failure ();
1868- opName->opName .emplace ((opName->dialect ->name + " ." + opName->name ).str (),
1869- getContext ());
1882+ }
18701883 }
18711884 }
18721885 return *opName->opName ;
0 commit comments