-
Notifications
You must be signed in to change notification settings - Fork 98
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
Fix clang tidy #819
Fix clang tidy #819
Conversation
C/C++ code formatter, clang-format found issues in your code. You can test this locally with the following command:git-clang-format --diff 900efbaa4c26243266708f4796fddfb949ba225d e658b7e079b35537b77128c26bb895343953afcc -- /home/runner/work/mlir-aie/mlir-aie/lib/Conversion/AIEVecToLLVM/AIEVecToLLVM.cpp /home/runner/work/mlir-aie/mlir-aie/lib/Dialect/AIE/IR/AIEDialect.cpp View the diff from clang-format here.diff --git a/lib/Conversion/AIEVecToLLVM/AIEVecToLLVM.cpp b/lib/Conversion/AIEVecToLLVM/AIEVecToLLVM.cpp
index 0d42a13..c6e76a7 100644
--- a/lib/Conversion/AIEVecToLLVM/AIEVecToLLVM.cpp
+++ b/lib/Conversion/AIEVecToLLVM/AIEVecToLLVM.cpp
@@ -29,7 +29,7 @@ namespace xilinx::aievec {
struct BufferParams {
uint32_t start;
uint32_t offsets;
- uint32_t offsets_hi;
+ uint32_t offsets_hi;
uint32_t step;
uint32_t square;
};
@@ -390,9 +390,9 @@ public:
// Determine the load size
// TODO: no examples of 1024-bit output vectors: doesn't feel right
// to attempt a 512-bit load to do an update like this
- int loadSize = vecSizeInBits == 256 ? 128
- : vecSizeInBits == 512 ? 256
- : 512;
+ int loadSize = vecSizeInBits == 256 ? 128
+ : vecSizeInBits == 512 ? 256
+ : 512;
// Create a vectorType for the load proper
// Load half of the final result vector
@@ -718,7 +718,7 @@ class MatMulOpConversion
using ConvertOpToLLVMPattern<aievec::MatMulOp>::ConvertOpToLLVMPattern;
struct DecodedMatMulOp {
- typedef enum { I32, I64, BF16 } Kind;
+ typedef enum { I32, I64, BF16 } Kind;
Kind kind;
Value lhs;
@@ -776,25 +776,25 @@ class MatMulOpConversion
unsigned rhsBitWidth = rhsScaTy.getWidth();
auto accScaTy = cast<IntegerType>(accVecTy.getElementType());
unsigned accBitWidth = accScaTy.getWidth();
- if (accBitWidth == 32) {
- if (lhsBitWidth == 8) {
- if (rhsBitWidth == 4) {
- // <4x16xi8> x <16x8xi4> + <4x8xi32>
- return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf};
- } else {
- // <4x8xi8> x <8x8xi8> + <4x8xi32>
- return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 8};
- }
- } else {
- if (rhsBitWidth == 8) {
- // <4x4xi16> x <4x8xi8> + <4x8xi32>
- return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 16};
- } else {
- // <4x2xi16> x <2x8xi16> + <4x8xi32>
- return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 2};
- }
- }
- }
+ if (accBitWidth == 32) {
+ if (lhsBitWidth == 8) {
+ if (rhsBitWidth == 4) {
+ // <4x16xi8> x <16x8xi4> + <4x8xi32>
+ return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf};
+ } else {
+ // <4x8xi8> x <8x8xi8> + <4x8xi32>
+ return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 8};
+ }
+ } else {
+ if (rhsBitWidth == 8) {
+ // <4x4xi16> x <4x8xi8> + <4x8xi32>
+ return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 16};
+ } else {
+ // <4x2xi16> x <2x8xi16> + <4x8xi32>
+ return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 2};
+ }
+ }
+ }
if (lhsBitWidth == 16) {
if (rhsBitWidth == 8) {
|
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.
Clang-Tidy
found issue(s) with the introduced code (1/1)
@@ -718,7 +718,7 @@ | |||
using ConvertOpToLLVMPattern<aievec::MatMulOp>::ConvertOpToLLVMPattern; | |||
|
|||
struct DecodedMatMulOp { | |||
typedef enum { I32, I64, BF16 } Kind; | |||
typedef enum { I32, I64, BF16 } Kind; |
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.
use using
instead of typedef
typedef enum { I32, I64, BF16 } Kind; | |
using Kind = enum { I32, I64, BF16 }; |
} else { | ||
// <4x8xi8> x <8x8xi8> + <4x8xi32> |
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.
do not use else
after return
} else { | |
// <4x8xi8> x <8x8xi8> + <4x8xi32> | |
} // <4x8xi8> x <8x8xi8> + <4x8xi32> |
} else { | ||
// <4x8xi8> x <8x8xi8> + <4x8xi32> | ||
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 8}; | ||
} |
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.
do not use else
after return
} | |
} else { | ||
// <4x2xi16> x <2x8xi16> + <4x8xi32> |
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.
do not use else
after return
} else { | |
// <4x2xi16> x <2x8xi16> + <4x8xi32> | |
} // <4x2xi16> x <2x8xi16> + <4x8xi32> |
} else { | ||
// <4x2xi16> x <2x8xi16> + <4x8xi32> | ||
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 2}; | ||
} |
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.
do not use else
after return
} | |
275ebda
to
e658b7e
Compare
Coverage ReportCreated: 2023-12-02 11:19Click here for information about interpreting this report.
Generated by llvm-cov -- llvm version 14.0.0 |
e658b7e
to
d6156f9
Compare
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.
Clang-Tidy
found issue(s) with the introduced code (1/1)
@@ -29,7 +29,7 @@ namespace xilinx::aievec { | |||
struct BufferParams { | |||
uint32_t start; | |||
uint32_t offsets; | |||
uint32_t offsets_hi; | |||
uint32_t offsets_hi; |
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.
invalid case style for member offsets_hi
uint32_t offsets_hi; | |
uint32_t offsetsHi; |
cf674cb
to
dd863ab
Compare
@@ -29,7 +29,7 @@ namespace xilinx::aievec { | |||
struct BufferParams { | |||
uint32_t start; | |||
uint32_t offsets; | |||
uint32_t offsets_hi; | |||
uint32_t offsets_hi; |
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.
[clang-format] reported by reviewdog 🐶
uint32_t offsets_hi; | |
uint32_t offsets_hi; |
int loadSize = vecSizeInBits == 256 ? 128 | ||
: vecSizeInBits == 512 ? 256 | ||
: 512; |
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.
[clang-format] reported by reviewdog 🐶
int loadSize = vecSizeInBits == 256 ? 128 | |
: vecSizeInBits == 512 ? 256 | |
: 512; | |
int loadSize = vecSizeInBits == 256 ? 128 | |
: vecSizeInBits == 512 ? 256 | |
: 512; |
@@ -718,7 +718,7 @@ class MatMulOpConversion | |||
using ConvertOpToLLVMPattern<aievec::MatMulOp>::ConvertOpToLLVMPattern; | |||
|
|||
struct DecodedMatMulOp { | |||
typedef enum { I32, I64, BF16 } Kind; | |||
typedef enum { I32, I64, BF16 } Kind; |
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.
[clang-format] reported by reviewdog 🐶
typedef enum { I32, I64, BF16 } Kind; | |
typedef enum { I32, I64, BF16 } Kind; |
if (accBitWidth == 32) { | ||
if (lhsBitWidth == 8) { | ||
if (rhsBitWidth == 4) { | ||
// <4x16xi8> x <16x8xi4> + <4x8xi32> | ||
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf}; | ||
} else { | ||
// <4x8xi8> x <8x8xi8> + <4x8xi32> | ||
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 8}; | ||
} | ||
} else { | ||
if (rhsBitWidth == 8) { | ||
// <4x4xi16> x <4x8xi8> + <4x8xi32> | ||
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 16}; | ||
} else { | ||
// <4x2xi16> x <2x8xi16> + <4x8xi32> | ||
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 2}; | ||
} | ||
} | ||
} |
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.
[clang-format] reported by reviewdog 🐶
if (accBitWidth == 32) { | |
if (lhsBitWidth == 8) { | |
if (rhsBitWidth == 4) { | |
// <4x16xi8> x <16x8xi4> + <4x8xi32> | |
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf}; | |
} else { | |
// <4x8xi8> x <8x8xi8> + <4x8xi32> | |
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 8}; | |
} | |
} else { | |
if (rhsBitWidth == 8) { | |
// <4x4xi16> x <4x8xi8> + <4x8xi32> | |
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 16}; | |
} else { | |
// <4x2xi16> x <2x8xi16> + <4x8xi32> | |
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 2}; | |
} | |
} | |
} | |
if (accBitWidth == 32) { | |
if (lhsBitWidth == 8) { | |
if (rhsBitWidth == 4) { | |
// <4x16xi8> x <16x8xi4> + <4x8xi32> | |
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf}; | |
} else { | |
// <4x8xi8> x <8x8xi8> + <4x8xi32> | |
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 8}; | |
} | |
} else { | |
if (rhsBitWidth == 8) { | |
// <4x4xi16> x <4x8xi8> + <4x8xi32> | |
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 16}; | |
} else { | |
// <4x2xi16> x <2x8xi16> + <4x8xi32> | |
return {DecodedMatMulOp::Kind::I32, lhs, rhs, acc, signConf | 2}; | |
} | |
} | |
} |
dd863ab
to
9c81050
Compare
No description provided.