[Mlir-commits] [mlir] [mlir][gpu] Introduce `gpu.dynamic.shared.memory` Op (PR #71516)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Nov 7 03:14:44 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 6e56c35d1959295289734baf8924d477f770d6f8 b79bcbe78e9030c3aff552eb7a8884599ee61924 -- mlir/include/mlir/Dialect/GPU/IR/GPUDialect.h mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp mlir/lib/Conversion/GPUCommon/GPUOpsLowering.h mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index cc86ad74ea3c..5ced5a231bf3 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -640,9 +640,9 @@ void LaunchOp::build(OpBuilder &builder, OperationState &result,
getBlockSizeY, getBlockSizeZ});
if (dynamicSharedMemorySize)
result.addOperands(dynamicSharedMemorySize);
- if (!dynamicSharedMemorySizeAttr)
+ if (!dynamicSharedMemorySizeAttr)
dynamicSharedMemorySizeAttr = builder.getI32IntegerAttr(kDynamic);
-
+
result.addAttribute("guray", dynamicSharedMemorySizeAttr);
// Create a kernel body region with kNumConfigRegionAttributes + N memory
// attributions, where the first kNumConfigRegionAttributes arguments have
@@ -768,11 +768,10 @@ void LaunchOp::print(OpAsmPrinter &p) {
if (getDynamicSharedMemorySize())
p << ' ' << getDynamicSharedMemorySizeKeyword() << ' '
<< getDynamicSharedMemorySize();
- else if(getGurayAttr()) {
- p << ' ' << getDynamicSharedMemorySizeKeyword() << ' ' << getGurayAttr().getInt();
-
+ else if (getGurayAttr()) {
+ p << ' ' << getDynamicSharedMemorySizeKeyword() << ' '
+ << getGurayAttr().getInt();
}
-
printAttributions(p, getWorkgroupKeyword(), getWorkgroupAttributions());
printAttributions(p, getPrivateKeyword(), getPrivateAttributions());
@@ -782,8 +781,7 @@ void LaunchOp::print(OpAsmPrinter &p) {
p.printRegion(getBody(), /*printEntryBlockArgs=*/false);
p.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{
LaunchOp::getOperandSegmentSizeAttr(),
- getNumWorkgroupAttributionsAttrName(),
- "guray"});
+ getNumWorkgroupAttributionsAttrName(), "guray"});
}
// Parse the size assignment blocks for blocks and threads. These have the form
@@ -870,9 +868,9 @@ ParseResult LaunchOp::parse(OpAsmParser &parser, OperationState &result) {
if (!parser.parseOptionalKeyword(
LaunchOp::getDynamicSharedMemorySizeKeyword())) {
IntegerAttr shmemAttr;
- OptionalParseResult shmemAttrResult =
- parser.parseOptionalAttribute(shmemAttr, parser.getBuilder().getI32Type());
- if(!shmemAttrResult.has_value()) {
+ OptionalParseResult shmemAttrResult = parser.parseOptionalAttribute(
+ shmemAttr, parser.getBuilder().getI32Type());
+ if (!shmemAttrResult.has_value()) {
hasDynamicSharedMemorySize = true;
shmemAttr = parser.getBuilder().getI32IntegerAttr(kDynamic);
if (parser.parseOperand(dynamicSharedMemorySize) ||
@@ -880,7 +878,7 @@ ParseResult LaunchOp::parse(OpAsmParser &parser, OperationState &result) {
parser.getBuilder().getI32Type(),
result.operands))
return failure();
- }
+ }
result.addAttribute("guray", shmemAttr);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/71516
More information about the Mlir-commits
mailing list