diff options
| author | Jeff Niu <jeff@modular.com> | 2024-04-10 23:34:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-10 23:34:48 +0200 |
| commit | fb771fe315654231f613a5501ebd538f036c78b6 (patch) | |
| tree | fbcdb914bfa72a63551e5ad505419826dacc0b57 /mlir/lib/Bytecode | |
| parent | 8cfa72ade9f2f7df81a008efea84f833b73494b9 (diff) | |
[mlir] Slightly optimize bytecode op numbering (#88310)
If the bytecode encoding supports properties, then the dictionary
attribute is always the raw dictionary attribute of the operation,
regardless of what it contains. Otherwise, get the dictionary attribute
from the op: if the op does not have properties, then it returns the raw
dictionary, otherwise it returns the combined inherent and discardable
attributes.
Diffstat (limited to 'mlir/lib/Bytecode')
| -rw-r--r-- | mlir/lib/Bytecode/Writer/IRNumbering.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mlir/lib/Bytecode/Writer/IRNumbering.cpp b/mlir/lib/Bytecode/Writer/IRNumbering.cpp index f36c9ef060b6..d2144dd7f334 100644 --- a/mlir/lib/Bytecode/Writer/IRNumbering.cpp +++ b/mlir/lib/Bytecode/Writer/IRNumbering.cpp @@ -424,22 +424,22 @@ void IRNumberingState::number(Operation &op) { number(result.getType()); } - // Only number the operation's dictionary if it isn't empty. - DictionaryAttr dictAttr = op.getDiscardableAttrDictionary(); // Prior to a version with native property encoding, or when properties are // not used, we need to number also the merged dictionary containing both the // inherent and discardable attribute. - if (config.getDesiredBytecodeVersion() < - bytecode::kNativePropertiesEncoding || - !op.getPropertiesStorage()) { + DictionaryAttr dictAttr; + if (config.getDesiredBytecodeVersion() >= bytecode::kNativePropertiesEncoding) + dictAttr = op.getRawDictionaryAttrs(); + else dictAttr = op.getAttrDictionary(); - } + // Only number the operation's dictionary if it isn't empty. if (!dictAttr.empty()) number(dictAttr); // Visit the operation properties (if any) to make sure referenced attributes // are numbered. - if (config.getDesiredBytecodeVersion() >= bytecode::kNativePropertiesEncoding && + if (config.getDesiredBytecodeVersion() >= + bytecode::kNativePropertiesEncoding && op.getPropertiesStorageSize()) { if (op.isRegistered()) { // Operation that have properties *must* implement this interface. |
