-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir] NFC: Fix layering check / parse headers violations #110117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Those tools check strict dependency and standalone headers in Google, but some internal build optimizations caused some violations not to be detected. This change adds a missing dependency, and includes some types that are needed for template instantiation.
@llvm/pr-subscribers-mlir-linalg @llvm/pr-subscribers-mlir Author: Walter Lee (googlewalt) ChangesThose tools check strict dependency and standalone headers in Google, but some internal build optimizations caused some violations not to be detected. This change adds a missing dependency, and includes some types that are needed for template instantiation. Full diff: https://github.com/llvm/llvm-project/pull/110117.diff 2 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h
index db25c9b241734f..9ede21e87cf530 100644
--- a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h
+++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h
@@ -14,6 +14,7 @@
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Transform/IR/TransformAttrs.h"
#include "mlir/Dialect/Transform/IR/TransformDialect.h"
+#include "mlir/Dialect/Transform/IR/TransformTypes.h"
#include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/IR/OpImplementation.h"
@@ -42,10 +43,6 @@ class UnPackOp;
} // namespace tensor
namespace transform {
-class AnyOpType;
-class AnyValueType;
-class OperationType;
-class TransformHandleTypeInterface;
// Types needed for builders.
struct TileSizesSpec {};
struct NumThreadsSpec {};
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index f5437245e8e135..a8b74b2376e71d 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -12370,6 +12370,7 @@ cc_library(
hdrs = glob(["include/mlir/Dialect/Transform/IR/*.h"]),
deps = [
":Analysis",
+ ":BytecodeOpInterface",
":CallOpInterfaces",
":CastInterfaces",
":ControlFlowInterfaces",
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. But what was the actual error message from parsing LinalgTransformOps.h without #include "mlir/Dialect/Transform/IR/TransformTypes.h"
?
Here is one example:
|
I don't understand why the change in the source file is needed? Why would the build be successful with CMake but not with Bazel? |
The error reported was from the bazel "parse_headers" validation feature, which tries to ensure that headers can be parsed by themselves, as a standalone compile step (via clang -fsyntax-only). In all the current uses of this header, the source-file already also includes the header defining the required types, so the actual compilation steps succeed just fine (in bazel, too). |
The header is included as the first include here:
|
Because template instantiation occurs after all the headers have been parsed, and a header that follows supplys the requried definitions. Without this change, LinalgTransformOps.h is not self contained. You can verify that by trying to compile a cpp file that only has that include in -- it will give the the same kind of errors that I had pasted earlier. |
Those tools check strict dependency and standalone headers in Google, but some internal build optimizations caused some violations not to be detected. This change adds a missing dependency, and includes some types that are needed for template instantiation.
Those tools check strict dependency and standalone headers in Google, but some internal build optimizations caused some violations not to be detected. This change adds a missing dependency, and includes some types that are needed for template instantiation.