[Mlir-commits] [mlir] [mlir] Add searchable remark history and query-based links (PR #237762)
Henrich Lauko
llvmlistbot at llvm.org
Tue Nov 3 01:35:19 PST 2026
================
@@ -139,13 +141,60 @@ struct RemarkOpts {
inline RemarkOpts relatedTo(const detail::InFlightRemark &r) const;
};
+/// Exact-match criteria for searching previously reported remarks. Unspecified
+/// fields match any value; a specified empty string matches an empty field.
+/// Strings are owned by the query. Locations belong to their MLIRContext and
+/// must not outlive it. A location match does not imply operation identity.
+class RemarkQuery {
+public:
+ RemarkQuery name(StringRef value) const {
+ auto copy = *this;
+ copy.remarkName = value.str();
+ return copy;
+ }
+ /// Match the base category, without the subcategory.
+ RemarkQuery category(StringRef value) const {
+ auto copy = *this;
+ copy.categoryName = value.str();
+ return copy;
+ }
+ RemarkQuery subCategory(StringRef value) const {
+ auto copy = *this;
+ copy.subCategoryName = value.str();
+ return copy;
+ }
+ RemarkQuery function(StringRef value) const {
+ auto copy = *this;
+ copy.functionName = value.str();
+ return copy;
+ }
+ RemarkQuery kind(RemarkKind value) const {
+ auto copy = *this;
+ copy.remarkKind = value;
+ return copy;
+ }
+ /// Match the complete location, including any wrapping locations.
+ RemarkQuery at(Location value) const {
+ auto copy = *this;
+ copy.location = value;
+ return copy;
+ }
+
+private:
+ friend class detail::RemarkEngine;
+ std::optional<std::string> remarkName, categoryName, subCategoryName,
+ functionName;
+ std::optional<RemarkKind> remarkKind;
+ std::optional<Location> location;
+};
} // namespace mlir::remark
namespace mlir::remark::detail {
//===----------------------------------------------------------------------===//
// Remark Base Class
//===----------------------------------------------------------------------===//
class Remark {
+ friend class RemarkEngine;
----------------
xlauko wrote:
The friend is only needed to read the raw name fields, because getRemarkName() and getFunction() return placeholders for empty values. I’d add raw accessors, or a static Entry::from(const Remark &), rather than give the engine access to everything in Remark.
https://github.com/llvm/llvm-project/pull/237762
More information about the Mlir-commits
mailing list