Skip to content
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

[mlir][arith][nfc] Fix typos #77700

Merged
merged 1 commit into from Jan 11, 2024
Merged

Conversation

Hardcode84
Copy link
Contributor

Cleanup after #77211

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 10, 2024

@llvm/pr-subscribers-mlir-llvm
@llvm/pr-subscribers-mlir-arith

@llvm/pr-subscribers-mlir

Author: Ivan Butygin (Hardcode84)

Changes

Cleanup after #77211


Full diff: https://github.com/llvm/llvm-project/pull/77700.diff

4 Files Affected:

  • (modified) mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h (+3-3)
  • (modified) mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td (+1-1)
  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.td (+1-1)
  • (modified) mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp (+3-3)
diff --git a/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h b/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h
index 0296ec969d0b32..32d7979c32dfb2 100644
--- a/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h
+++ b/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h
@@ -29,12 +29,12 @@ convertArithFastMathAttrToLLVM(arith::FastMathFlagsAttr fmfAttr);
 
 /// Maps arithmetic overflow enum values to LLVM enum values.
 LLVM::IntegerOverflowFlags
-convertArithOveflowFlagsToLLVM(arith::IntegerOverflowFlags arithFlags);
+convertArithOverflowFlagsToLLVM(arith::IntegerOverflowFlags arithFlags);
 
 /// Creates an LLVM overflow attribute from a given arithmetic overflow
 /// attribute.
 LLVM::IntegerOverflowFlagsAttr
-convertArithOveflowAttrToLLVM(arith::IntegerOverflowFlagsAttr flagsAttr);
+convertArithOverflowAttrToLLVM(arith::IntegerOverflowFlagsAttr flagsAttr);
 
 // Attribute converter that populates a NamedAttrList by removing the fastmath
 // attribute from the source operation attributes, and replacing it with an
@@ -80,7 +80,7 @@ class AttrConvertOverflowToLLVM {
     if (arithAttr) {
       StringRef targetAttrName = TargetOp::getIntegerOverflowAttrName();
       convertedAttr.set(targetAttrName,
-                        convertArithOveflowAttrToLLVM(arithAttr));
+                        convertArithOverflowAttrToLLVM(arithAttr));
     }
   }
 
diff --git a/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td b/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td
index e248422f84db84..73a5d9c32ef205 100644
--- a/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td
+++ b/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td
@@ -93,7 +93,7 @@ def ArithIntegerOverflowFlagsInterface : OpInterface<"ArithIntegerOverflowFlagsI
       }]
       >,
     StaticInterfaceMethod<
-      /*desc=*/        [{Returns the name of the IntegerOveflowFlagsAttr attribute
+      /*desc=*/        [{Returns the name of the IntegerOverflowFlagsAttr attribute
                          for the operation}],
       /*returnType=*/  "StringRef",
       /*methodName=*/  "getIntegerOverflowAttrName",
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.td
index 81589eaf5fd0a4..3b2a132a881e4e 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.td
@@ -92,7 +92,7 @@ def IntegerOverflowFlagsInterface : OpInterface<"IntegerOverflowFlagsInterface">
       }]
       >,
     StaticInterfaceMethod<
-      /*desc=*/        [{Returns the name of the IntegerOveflowFlagsAttr attribute
+      /*desc=*/        [{Returns the name of the IntegerOverflowFlagsAttr attribute
                          for the operation}],
       /*returnType=*/  "StringRef",
       /*methodName=*/  "getIntegerOverflowAttrName",
diff --git a/mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp b/mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp
index 3e9aef87b9ef1f..dab064a3a954ec 100644
--- a/mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp
+++ b/mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp
@@ -35,7 +35,7 @@ mlir::arith::convertArithFastMathAttrToLLVM(arith::FastMathFlagsAttr fmfAttr) {
       fmfAttr.getContext(), convertArithFastMathFlagsToLLVM(arithFMF));
 }
 
-LLVM::IntegerOverflowFlags mlir::arith::convertArithOveflowFlagsToLLVM(
+LLVM::IntegerOverflowFlags mlir::arith::convertArithOverflowFlagsToLLVM(
     arith::IntegerOverflowFlags arithFlags) {
   LLVM::IntegerOverflowFlags llvmFlags{};
   const std::pair<arith::IntegerOverflowFlags, LLVM::IntegerOverflowFlags>
@@ -49,9 +49,9 @@ LLVM::IntegerOverflowFlags mlir::arith::convertArithOveflowFlagsToLLVM(
   return llvmFlags;
 }
 
-LLVM::IntegerOverflowFlagsAttr mlir::arith::convertArithOveflowAttrToLLVM(
+LLVM::IntegerOverflowFlagsAttr mlir::arith::convertArithOverflowAttrToLLVM(
     arith::IntegerOverflowFlagsAttr flagsAttr) {
   arith::IntegerOverflowFlags arithFlags = flagsAttr.getValue();
   return LLVM::IntegerOverflowFlagsAttr::get(
-      flagsAttr.getContext(), convertArithOveflowFlagsToLLVM(arithFlags));
+      flagsAttr.getContext(), convertArithOverflowFlagsToLLVM(arithFlags));
 }

@Hardcode84 Hardcode84 merged commit 9ed3001 into llvm:main Jan 11, 2024
6 of 7 checks passed
@Hardcode84 Hardcode84 deleted the overflow-typos branch January 11, 2024 03:52
Hardcode84 added a commit that referenced this pull request Jan 11, 2024
Temporarily reverting as it broke python bindings

This reverts commit 9ed3001.
jpienaar pushed a commit to jpienaar/llvm-project that referenced this pull request Jan 17, 2024
Add overflow flags support to the following ops:
* `arith.addi`
* `arith.subi`
* `arith.muli`

Example of new syntax:
```
%res = arith.addi %arg1, %arg2 overflow<nsw> : i64
```
Similar to existing LLVM dialect syntax
```
%res = llvm.add %arg1, %arg2 overflow<nsw> : i64
```

Tablegen canonicalization patterns updated to always drop flags, proper
support with tests will be added later.

Updated LLVMIR translation as part of this commit as it currenly written
in a way that it will crash when new attributes added to arith ops
otherwise.

Also lower `arith` overflow flags to corresponding SPIR-V op decorations

Discussion
https://discourse.llvm.org/t/rfc-integer-overflow-flags-support-in-arith-dialect/76025

This effectively rolls forward llvm#77211, llvm#77700 and llvm#77714 while adding a
test to ensure the Python usage is not broken. More follow up needed but
unrelated to the core change here. The changes here are minimal and just
correspond to "textual namespacing" ODS side, no C++ or Python changes
were needed.

---------

Co-authored-by: Ivan Butygin <ivan.butygin@gmail.com>, Yi Wu <yi.wu2@arm.com>
Hardcode84 pushed a commit that referenced this pull request Jan 17, 2024
Add overflow flags support to the following ops:
* `arith.addi`
* `arith.subi`
* `arith.muli`

Example of new syntax:
```
%res = arith.addi %arg1, %arg2 overflow<nsw> : i64
```
Similar to existing LLVM dialect syntax
```
%res = llvm.add %arg1, %arg2 overflow<nsw> : i64
```

Tablegen canonicalization patterns updated to always drop flags, proper
support with tests will be added later.

Updated LLVMIR translation as part of this commit as it currenly written
in a way that it will crash when new attributes added to arith ops
otherwise.

Also lower `arith` overflow flags to corresponding SPIR-V op decorations

Discussion

https://discourse.llvm.org/t/rfc-integer-overflow-flags-support-in-arith-dialect/76025

This effectively rolls forward #77211, #77700 and #77714 while adding a
test to ensure the Python usage is not broken. More follow up needed but
unrelated to the core change here. The changes here are minimal and just
correspond to "textual namespacing" ODS side, no C++ or Python changes
were needed.

---------

---------

Co-authored-by: Ivan Butygin <ivan.butygin@gmail.com>, Yi Wu <yi.wu2@arm.com>
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
Temporarily reverting as it broke python bindings

This reverts commit 9ed3001.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants