[Mlir-commits] [mlir] [MLIR][Python] Forward the name of MLIR types to Python side (PR #174700)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Jan 6 22:14:56 PST 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-c/BuiltinTypes.h mlir/include/mlir-c/Dialect/AMDGPU.h mlir/include/mlir-c/Dialect/EmitC.h mlir/include/mlir-c/Dialect/GPU.h mlir/include/mlir-c/Dialect/LLVM.h mlir/include/mlir-c/Dialect/NVGPU.h mlir/include/mlir-c/Dialect/PDL.h mlir/include/mlir-c/Dialect/Quant.h mlir/include/mlir-c/Dialect/SMT.h mlir/include/mlir-c/Dialect/Transform.h mlir/include/mlir/Bindings/Python/IRCore.h mlir/include/mlir/Bindings/Python/IRTypes.h mlir/lib/Bindings/Python/DialectAMDGPU.cpp mlir/lib/Bindings/Python/DialectGPU.cpp mlir/lib/Bindings/Python/DialectLLVM.cpp mlir/lib/Bindings/Python/DialectNVGPU.cpp mlir/lib/Bindings/Python/DialectPDL.cpp mlir/lib/Bindings/Python/DialectQuant.cpp mlir/lib/Bindings/Python/DialectSMT.cpp mlir/lib/Bindings/Python/DialectTransform.cpp mlir/lib/CAPI/Dialect/AMDGPU.cpp mlir/lib/CAPI/Dialect/EmitC.cpp mlir/lib/CAPI/Dialect/GPU.cpp mlir/lib/CAPI/Dialect/LLVM.cpp mlir/lib/CAPI/Dialect/NVGPU.cpp mlir/lib/CAPI/Dialect/PDL.cpp mlir/lib/CAPI/Dialect/Quant.cpp mlir/lib/CAPI/Dialect/SMT.cpp mlir/lib/CAPI/Dialect/Transform.cpp mlir/lib/CAPI/IR/BuiltinTypes.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/include/mlir-c/Dialect/Quant.h b/mlir/include/mlir-c/Dialect/Quant.h
index 4fe0fba25..ced5a7532 100644
--- a/mlir/include/mlir-c/Dialect/Quant.h
+++ b/mlir/include/mlir-c/Dialect/Quant.h
@@ -206,7 +206,8 @@ MLIR_CAPI_EXPORTED MlirType mlirUniformQuantizedSubChannelTypeGet(
     intptr_t blockSizeInfoLength, int32_t *quantizedDimensions,
     int64_t *blockSizes, int64_t storageTypeMin, int64_t storageTypeMax);
 
-MLIR_CAPI_EXPORTED MlirStringRef mlirUniformQuantizedSubChannelTypeGetName(void);
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirUniformQuantizedSubChannelTypeGetName(void);
 
 /// Returns the number of block sizes provided in type.
 MLIR_CAPI_EXPORTED intptr_t
diff --git a/mlir/lib/Bindings/Python/DialectAMDGPU.cpp b/mlir/lib/Bindings/Python/DialectAMDGPU.cpp
index 393c360e5..e5a969fff 100644
--- a/mlir/lib/Bindings/Python/DialectAMDGPU.cpp
+++ b/mlir/lib/Bindings/Python/DialectAMDGPU.cpp
@@ -48,8 +48,7 @@ struct TDMDescriptorType : PyConcreteType<TDMDescriptorType> {
   static constexpr GetTypeIDFunctionTy getTypeIdFunction =
       mlirAMDGPUTDMDescriptorTypeGetTypeID;
   static constexpr const char *pyClassName = "TDMDescriptorType";
-  static inline const MlirStringRef name =
-    mlirAMDGPUTDMDescriptorTypeGetName();
+  static inline const MlirStringRef name = mlirAMDGPUTDMDescriptorTypeGetName();
   using Base::Base;
 
   static void bindDerived(ClassTy &c) {
@@ -71,8 +70,7 @@ struct TDMGatherBaseType : PyConcreteType<TDMGatherBaseType> {
   static constexpr GetTypeIDFunctionTy getTypeIdFunction =
       mlirAMDGPUTDMGatherBaseTypeGetTypeID;
   static constexpr const char *pyClassName = "TDMGatherBaseType";
-  static inline const MlirStringRef name =
-    mlirAMDGPUTDMGatherBaseTypeGetName();
+  static inline const MlirStringRef name = mlirAMDGPUTDMGatherBaseTypeGetName();
   using Base::Base;
 
   static void bindDerived(ClassTy &c) {
diff --git a/mlir/lib/Bindings/Python/DialectQuant.cpp b/mlir/lib/Bindings/Python/DialectQuant.cpp
index b23affa7f..0cf0e767e 100644
--- a/mlir/lib/Bindings/Python/DialectQuant.cpp
+++ b/mlir/lib/Bindings/Python/DialectQuant.cpp
@@ -286,7 +286,7 @@ struct UniformQuantizedPerAxisType
       mlirUniformQuantizedPerAxisTypeGetTypeID;
   static constexpr const char *pyClassName = "UniformQuantizedPerAxisType";
   static inline const MlirStringRef name =
-    mlirUniformQuantizedPerAxisTypeGetName();
+      mlirUniformQuantizedPerAxisTypeGetName();
   using Base::Base;
 
   static void bindDerived(ClassTy &c) {
@@ -374,7 +374,7 @@ struct UniformQuantizedSubChannelType
       mlirUniformQuantizedSubChannelTypeGetTypeID;
   static constexpr const char *pyClassName = "UniformQuantizedSubChannelType";
   static inline const MlirStringRef name =
-    mlirUniformQuantizedSubChannelTypeGetName();
+      mlirUniformQuantizedSubChannelTypeGetName();
   using Base::Base;
 
   static void bindDerived(ClassTy &c) {
@@ -468,8 +468,7 @@ struct CalibratedQuantizedType
   static constexpr GetTypeIDFunctionTy getTypeIdFunction =
       mlirCalibratedQuantizedTypeGetTypeID;
   static constexpr const char *pyClassName = "CalibratedQuantizedType";
-  static inline const MlirStringRef name =
-    mlirCalibratedQuantizedTypeGetName();
+  static inline const MlirStringRef name = mlirCalibratedQuantizedTypeGetName();
   using Base::Base;
 
   static void bindDerived(ClassTy &c) {
diff --git a/mlir/lib/CAPI/Dialect/PDL.cpp b/mlir/lib/CAPI/Dialect/PDL.cpp
index e707a05d0..b0580816d 100644
--- a/mlir/lib/CAPI/Dialect/PDL.cpp
+++ b/mlir/lib/CAPI/Dialect/PDL.cpp
@@ -80,7 +80,9 @@ MlirType mlirPDLRangeTypeGet(MlirType elementType) {
   return wrap(pdl::RangeType::get(unwrap(elementType)));
 }
 
-MlirStringRef mlirPDLRangeTypeGetName(void) { return wrap(pdl::RangeType::name); }
+MlirStringRef mlirPDLRangeTypeGetName(void) {
+  return wrap(pdl::RangeType::name);
+}
 
 MlirType mlirPDLRangeTypeGetElementType(MlirType type) {
   return wrap(cast<pdl::RangeType>(unwrap(type)).getElementType());
@@ -120,4 +122,6 @@ MlirType mlirPDLValueTypeGet(MlirContext ctx) {
   return wrap(pdl::ValueType::get(unwrap(ctx)));
 }
 
-MlirStringRef mlirPDLValueTypeGetName(void) { return wrap(pdl::ValueType::name); }
+MlirStringRef mlirPDLValueTypeGetName(void) {
+  return wrap(pdl::ValueType::name);
+}

``````````

</details>


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


More information about the Mlir-commits mailing list