[Mlir-commits] [mlir] [mlir][SPIRV] Lower ptr dialect to PBA addresses (PR #206159)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Jun 27 03:26:30 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 h,cpp -- mlir/include/mlir/Conversion/PtrToSPIRV/PtrToSPIRV.h mlir/lib/Conversion/PtrToSPIRV/PtrToSPIRV.cpp mlir/include/mlir/Conversion/Passes.h --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/include/mlir/Conversion/PtrToSPIRV/PtrToSPIRV.h b/mlir/include/mlir/Conversion/PtrToSPIRV/PtrToSPIRV.h
index 0ee44ab14..2e7463b60 100644
--- a/mlir/include/mlir/Conversion/PtrToSPIRV/PtrToSPIRV.h
+++ b/mlir/include/mlir/Conversion/PtrToSPIRV/PtrToSPIRV.h
@@ -25,10 +25,10 @@ namespace ptr {
 void populatePtrToSPIRVTypeConversions(SPIRVTypeConverter &typeConverter);
 
 /// Appends patterns for lowering ptr dialect operations to SPIR-V operations.
-void populatePtrToSPIRVPatterns(
-    const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns,
-    spirv::StorageClass storageClass =
-        spirv::StorageClass::PhysicalStorageBuffer);
+void populatePtrToSPIRVPatterns(const SPIRVTypeConverter &typeConverter,
+                                RewritePatternSet &patterns,
+                                spirv::StorageClass storageClass =
+                                    spirv::StorageClass::PhysicalStorageBuffer);
 
 std::unique_ptr<OperationPass<>> createConvertPtrToSPIRVPass();
 } // namespace ptr
diff --git a/mlir/lib/Conversion/PtrToSPIRV/PtrToSPIRV.cpp b/mlir/lib/Conversion/PtrToSPIRV/PtrToSPIRV.cpp
index 68dc5c307..813bc6fb1 100644
--- a/mlir/lib/Conversion/PtrToSPIRV/PtrToSPIRV.cpp
+++ b/mlir/lib/Conversion/PtrToSPIRV/PtrToSPIRV.cpp
@@ -167,9 +167,9 @@ struct PtrLoadOpConverter final : public OpConversionPattern<ptr::LoadOp> {
     if (!convertedType)
       return rewriter.notifyMatchFailure(op, "result type is not convertible");
 
-    FailureOr<Value> ptr = castAddressToPointeeType(
-        op, adaptor.getPtr(), convertedType, storageClass, op.getLoc(),
-        rewriter);
+    FailureOr<Value> ptr =
+        castAddressToPointeeType(op, adaptor.getPtr(), convertedType,
+                                 storageClass, op.getLoc(), rewriter);
     if (failed(ptr))
       return failure();
 
@@ -274,14 +274,13 @@ struct ConvertPtrToSPIRVPass final
 void mlir::ptr::populatePtrToSPIRVTypeConversions(
     SPIRVTypeConverter &typeConverter) {
   spirv::TargetEnvAttr targetAttr = typeConverter.getTargetEnv().getAttr();
-  typeConverter.addConversion(
-      [targetAttr](ptr::PtrType type) -> std::optional<Type> {
-        FailureOr<Type> addressType =
-            getAddressType(targetAttr, type.getContext());
-        if (failed(addressType))
-          return std::nullopt;
-        return *addressType;
-      });
+  typeConverter.addConversion([targetAttr](
+                                  ptr::PtrType type) -> std::optional<Type> {
+    FailureOr<Type> addressType = getAddressType(targetAttr, type.getContext());
+    if (failed(addressType))
+      return std::nullopt;
+    return *addressType;
+  });
 }
 
 void mlir::ptr::populatePtrToSPIRVPatterns(

``````````

</details>


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


More information about the Mlir-commits mailing list