-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[mlir] Ensure fmaximum/fminimum is defined in mlir/Dialect/LLVMIR/LLVMEnums.td #138198
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
…tions in #137701 Fix a compile error (with LLVM_ENABLE_WERROR=On) when building `bin/flang`: ``` enumeration values 'FMaximum' and 'FMinimum' not handled in switch ``` caused by adding new LLVM IR instructions in #137701. This wasn't picked up by the auto CI test on GitHub, so I hadn't realised until @kazutakahirata notified me about it.
@llvm/pr-subscribers-mlir-llvm @llvm/pr-subscribers-mlir Author: Jonathan Thackray (jthackray) ChangesFix a compile error (with LLVM_ENABLE_WERROR=On) when building
caused by adding new LLVM IR instructions in #137701. This wasn't picked up by the auto CI builders on GitHub, so I hadn't Full diff: https://github.com/llvm/llvm-project/pull/138198.diff 1 Files Affected:
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td
index 6c0fe363d5551..596f562911f8f 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td
@@ -110,6 +110,8 @@ def AtomicBinOpUSubCond : LLVM_EnumAttrCase<"usub_cond",
"usub_cond", "USubCond", 17>;
def AtomicBinOpUSubSat : LLVM_EnumAttrCase<"usub_sat",
"usub_sat", "USubSat", 18>;
+def AtomicBinOpFMaximum : LLVM_EnumAttrCase<"fmaximum", "fmaximum", "FMaximum", 19>;
+def AtomicBinOpFMinimum : LLVM_EnumAttrCase<"fminimum", "fminimum", "FMinimum", 20>;
// A sentinel value that has no MLIR counterpart.
def AtomicBadBinOp : LLVM_EnumAttrCase<"", "", "BAD_BINOP", 0>;
@@ -122,7 +124,8 @@ def AtomicBinOp : LLVM_EnumAttr<
AtomicBinOpNand, AtomicBinOpOr, AtomicBinOpXor, AtomicBinOpMax,
AtomicBinOpMin, AtomicBinOpUMax, AtomicBinOpUMin, AtomicBinOpFAdd,
AtomicBinOpFSub, AtomicBinOpFMax, AtomicBinOpFMin, AtomicBinOpUIncWrap,
- AtomicBinOpUDecWrap, AtomicBinOpUSubCond, AtomicBinOpUSubSat],
+ AtomicBinOpUDecWrap, AtomicBinOpUSubCond, AtomicBinOpUSubSat,
+ AtomicBinOpFMaximum, AtomicBinOpFMinimum],
[AtomicBadBinOp]> {
let cppNamespace = "::mlir::LLVM";
}
|
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.
Probably should have tests showing this translates correctly?
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.
Approved
Can you do me a favor and have a followup PR where you hook these up to memref.atomicrmw
?
(Huh, yeah, should have a test) |
Thanks @arsenm. I'm not familiar with where existing tests for other atomics are tested in this way. Can you point them out to me? Thanks. |
@krzysz00 - sure, not sure exactly how to do that, but I'll give it a try tomorrow. |
I don't know how to mlir, but I would hope there is an existing test to adjust. the closest match grep finds is mlir/test/Target/LLVMIR/llvmir.mlir? seems to cover too much, but has most atomicrmw ops covered |
The tests are in |
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.
Thank you for reproducing and fixing the problem quickly!
No problem - sorry I didn't see your original comment 17 hours ago. This won't get merged until tomorrow and I've added tests - hope you can wait until then. You can manually apply my patch to your local build if you need it sooner. |
✅ With the latest revision this PR passed the C/C++ code formatter. |
2db656e
to
1853659
Compare
Fix a compile error (with LLVM_ENABLE_WERROR=On) when building
bin/flang
:caused by adding new LLVM IR instructions in #137701.
This wasn't picked up by the auto CI builders on GitHub, so I hadn't
realised until @kazutakahirata notified me about it.