This commit introduces functionality to import loop metadata. Loop
metadata nodes are transformed into LoopAnnotationAttrs and attached to
the corresponding branch operations.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp | ||
---|---|---|
153 | Shouldn't there be a check if for a failure? | |
156 | maybe iterator based initialization works here (not 100% sure): | |
162 | nit: Let's also mention that the attribute is attached to the op? Converts the given loop metadata node to an MLIR loop annotation attribute and attaches it to the imported operation if the translation succeeds. Returns failure otherwise. | |
mlir/lib/Target/LLVMIR/LoopAnnotationImporter.cpp | ||
18 | ultra nit: that keeps the state | |
90 | Could it happen that the same name appears twice? | |
144 | I would probably rename to something that starts with a verb, e.g. emitValueWarning or just emitWarning. | |
237 | nit: emptyParam -> isEmptyOrNull? | |
260 | nit: let's spell out the types here. | |
349 | I think the * operator is preferred and the types here and on the line below should probably be spelled out. | |
353 | I would use llvm::append_range here since we are appending possibly multiple time. Additionally the * operator is preferred over .value() | |
376 | ultra nit: no need to change but wouldn't annotationMap be the better fit here? | |
395 | ultra nit: in these cases loopMetadataMapping.find may be the preferred choice since only one search is needed. | |
mlir/lib/Target/LLVMIR/LoopAnnotationImporter.h | ||
15 | nit: | |
mlir/lib/Target/LLVMIR/ModuleImport.cpp | ||
1578 | nit: either an access group or even a single access group | |
mlir/test/Target/LLVMIR/Import/metadata-loop.ll | ||
33 | nit: you could use CHECK-LABEL but then all variables matched before need to be prefixed with a dollar: #[[$ANNOT_ATTR:.*] = |
address reviewer comments
mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp | ||
---|---|---|
156 | That works :) | |
mlir/lib/Target/LLVMIR/LoopAnnotationImporter.cpp | ||
90 | Good catch, added a check and a corresponding test. | |
144 | Changed to emitNodeWarning as emitWarning leads to a name clash. | |
376 | Depends on the definition of "annotation" in this context. The whole attribute is called LoopAnnotationAttr, so calling each field of it an annotation might be a term overload. |
LGTM modulo the underscore comment.
mlir/lib/Target/LLVMIR/LoopAnnotationImporter.cpp | ||
---|---|---|
90 | nit I believe this produces a warning. Usually the way to go is to put a variable name and then to (void)dummy on the next line. |
Shouldn't there be a check if for a failure?