[Mlir-commits] [flang] [mlir] [mlir][GPU] Refactor GPUOps lowering (PR #188905)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Mar 30 00:43:36 PDT 2026


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 origin/main HEAD --extensions cpp,h -- mlir/include/mlir/Conversion/LLVMCommon/LowerFunctionAttrsToLLVM.h mlir/lib/Conversion/LLVMCommon/LowerFunctionAttrsToLLVM.cpp flang/lib/Optimizer/Transforms/CUDA/CUFDeviceFuncTransform.cpp mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp mlir/lib/Conversion/GPUCommon/GPUOpsLowering.h mlir/lib/Dialect/GPU/IR/GPUDialect.cpp mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp mlir/lib/Dialect/XeGPU/Transforms/XeGPUSubgroupDistribute.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
index f78274fbd..14cca75cf 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
@@ -90,8 +90,9 @@ FailureOr<LowerLLVMFuncAttrs> GPUFuncOpLowering::buildLoweredGPULLVMFuncAttrs(
   props.sym_name = rewriter.getStringAttr(gpuFuncOp.getName());
   props.function_type = TypeAttr::get(llvmFuncType);
   const bool isKernelFunc = gpuFuncOp.isKernel();
-  props.setCConv(LLVM::CConvAttr::get(
-      ctx, isKernelFunc ? kernelCallingConvention : nonKernelCallingConvention));
+  props.setCConv(LLVM::CConvAttr::get(ctx, isKernelFunc
+                                               ? kernelCallingConvention
+                                               : nonKernelCallingConvention));
 
   NamedAttrList &discardable = loweredAttrs->discardableAttrs;
   auto *gpuDialect = cast<gpu::GPUDialect>(gpuFuncOp->getDialect());
@@ -259,9 +260,9 @@ GPUFuncOpLowering::matchAndRewrite(gpu::GPUFuncOp gpuFuncOp, OpAdaptor adaptor,
       ArrayRef<BlockArgument> attributionArguments =
           gpuFuncOp.getArguments().slice(numProperArguments - numAttributions,
                                          numAttributions);
-      for (auto [idx, vals] : llvm::enumerate(llvm::zip_equal(
-               gpuFuncOp.getWorkgroupAttributionBBArgs(),
-               attributionArguments))) {
+      for (auto [idx, vals] : llvm::enumerate(
+               llvm::zip_equal(gpuFuncOp.getWorkgroupAttributionBBArgs(),
+                               attributionArguments))) {
         auto [attribution, arg] = vals;
         auto type = cast<MemRefType>(attribution.getType());
 
diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index 085314123..17e7a8be5 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -1693,8 +1693,9 @@ ParseResult GPUFuncOp::parse(OpAsmParser &parser, OperationState &result) {
   // memory attributions.
   unsigned numWorkgroupAttrs = entryArgs.size() - type.getNumInputs();
   if (numWorkgroupAttrs != 0)
-    result.addAttribute(GPUFuncOp::getWorkgroupAttributionsAttrName(result.name),
-                        builder.getI64IntegerAttr(numWorkgroupAttrs));
+    result.addAttribute(
+        GPUFuncOp::getWorkgroupAttributionsAttrName(result.name),
+        builder.getI64IntegerAttr(numWorkgroupAttrs));
   if (workgroupAttributionAttrs)
     result.addAttribute(GPUFuncOp::getWorkgroupAttribAttrsAttrName(result.name),
                         workgroupAttributionAttrs);

``````````

</details>


https://github.com/llvm/llvm-project/pull/188905


More information about the Mlir-commits mailing list