-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[mlir][Transforms] Fix build after #116524 (part 2) #121662
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
@llvm/pr-subscribers-mlir Author: Matthias Springer (matthias-springer) ChangesSince #116524, an integration test started to become flaky (failure rate ~15%).
I traced the issue back to the Full diff: https://github.com/llvm/llvm-project/pull/121662.diff 1 Files Affected:
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 0e577d2d39de3d..48b8c727a78285 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -103,8 +103,8 @@ namespace {
/// Helper class to make it possible to use `ValueVector` as a key in DenseMap.
struct ValueVectorMapInfo {
- static ValueVector getEmptyKey() { return ValueVector{}; }
- static ValueVector getTombstoneKey() { return ValueVector{}; }
+ static ValueVector getEmptyKey() { return ValueVector{Value()}; }
+ static ValueVector getTombstoneKey() { return ValueVector{Value(), Value()}; }
static ::llvm::hash_code getHashValue(const ValueVector &val) {
return ::llvm::hash_combine_range(val.begin(), val.end());
}
|
@llvm/pr-subscribers-mlir-core Author: Matthias Springer (matthias-springer) ChangesSince #116524, an integration test started to become flaky (failure rate ~15%).
I traced the issue back to the Full diff: https://github.com/llvm/llvm-project/pull/121662.diff 1 Files Affected:
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 0e577d2d39de3d..48b8c727a78285 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -103,8 +103,8 @@ namespace {
/// Helper class to make it possible to use `ValueVector` as a key in DenseMap.
struct ValueVectorMapInfo {
- static ValueVector getEmptyKey() { return ValueVector{}; }
- static ValueVector getTombstoneKey() { return ValueVector{}; }
+ static ValueVector getEmptyKey() { return ValueVector{Value()}; }
+ static ValueVector getTombstoneKey() { return ValueVector{Value(), Value()}; }
static ::llvm::hash_code getHashValue(const ValueVector &val) {
return ::llvm::hash_combine_range(val.begin(), val.end());
}
|
I merged this PR immediately to fix the build. But it is unclear to me why this fix was necessary. @zero9178, you commented about |
This is how I noticed that something was wrong: for (auto it : rewriterImpl.mapping.mapping) {
const auto &s = it.second;
const auto &f = it.first;
llvm::errs() << "A : " << rewriterImpl.mapping.mapping.contains(s) << "\n";
llvm::errs() << "B : " << rewriterImpl.mapping.mapping.contains(f) << "\n";
} Without this PR, the above code sometimes prints:
|
Mostly speculating, but based on the syndromes and the fix I think it is probably the following: Usually llvm-project/llvm/include/llvm/ADT/DenseMap.h Lines 609 to 618 in fd38a95
llvm-project/llvm/include/llvm/ADT/DenseMap.h Lines 332 to 335 in fd38a95
Meaning that if:
|
That makes sense! So the lesson learned here is: |
Since #116524, an integration test started to become flaky (failure rate ~15%).
I traced the issue back to the
DenseMap<ValueVector, ValueVector, ValueVectorMapInfo> mapping;
data structure: previously, somemapping.erase(foo)
calls were unsuccessful (returningfalse
), even though themapping
containsfoo
as a key.