summaryrefslogtreecommitdiff
path: root/mlir/lib/Bytecode
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Bytecode')
-rw-r--r--mlir/lib/Bytecode/Writer/BytecodeWriter.cpp7
-rw-r--r--mlir/lib/Bytecode/Writer/IRNumbering.cpp7
2 files changed, 9 insertions, 5 deletions
diff --git a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
index 6097f0eda469..9493a6c19a10 100644
--- a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
+++ b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
@@ -962,9 +962,12 @@ LogicalResult BytecodeWriter::writeOp(EncodingEmitter &emitter, Operation *op) {
DictionaryAttr attrs = op->getDiscardableAttrDictionary();
// Allow deployment to version <kNativePropertiesEncoding by merging inherent
// attribute with the discardable ones. We should fail if there are any
- // conflicts.
- if (config.bytecodeVersion < bytecode::kNativePropertiesEncoding)
+ // conflicts. When properties are not used by the op, also store everything as
+ // attributes.
+ if (config.bytecodeVersion < bytecode::kNativePropertiesEncoding ||
+ !op->getPropertiesStorage()) {
attrs = op->getAttrDictionary();
+ }
if (!attrs.empty()) {
opEncodingMask |= bytecode::OpEncodingMask::kHasAttrs;
emitter.emitVarInt(numberingState.getNumber(attrs));
diff --git a/mlir/lib/Bytecode/Writer/IRNumbering.cpp b/mlir/lib/Bytecode/Writer/IRNumbering.cpp
index 036a9477cce6..a306010698f2 100644
--- a/mlir/lib/Bytecode/Writer/IRNumbering.cpp
+++ b/mlir/lib/Bytecode/Writer/IRNumbering.cpp
@@ -425,9 +425,10 @@ void IRNumberingState::number(Operation &op) {
// Only number the operation's dictionary if it isn't empty.
DictionaryAttr dictAttr = op.getDiscardableAttrDictionary();
- // Prior to version 5 we need to number also the merged dictionnary
- // containing both the inherent and discardable attribute.
- if (config.getDesiredBytecodeVersion() < 5)
+ // Prior to version 5, or when properties are not used, we need to number also
+ // the merged dictionary containing both the inherent and discardable
+ // attribute.
+ if (config.getDesiredBytecodeVersion() < 5 || !op.getPropertiesStorage())
dictAttr = op.getAttrDictionary();
if (!dictAttr.empty())
number(dictAttr);