[Mlir-commits] [mlir] [mlir][py] Add NVGPU's `TensorMapDescriptorType` in py bindings (PR #88855)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Tue Apr 16 01:52:09 PDT 2024


================
@@ -9,5 +9,23 @@
 #include "mlir-c/Dialect/NVGPU.h"
 #include "mlir/CAPI/Registration.h"
 #include "mlir/Dialect/NVGPU/IR/NVGPUDialect.h"
+#include "mlir/IR/BuiltinTypes.h"
+
+using namespace mlir;
+using namespace mlir::nvgpu;
 
 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(NVGPU, nvgpu, mlir::nvgpu::NVGPUDialect)
+
+bool mlirTypeIsANVGPUTensorMapDescriptorType(MlirType type) {
+  return isa<nvgpu::TensorMapDescriptorType>(unwrap(type));
+}
+
+MlirType mlirNVGPUTensorMapDescriptorTypeGet(MlirContext ctx,
+                                             MlirType tensorType, int swizzle,
+                                             int l2promo, int oob,
+                                             int interleave) {
+  return wrap(nvgpu::TensorMapDescriptorType::get(
+      unwrap(ctx), cast<MemRefType>(unwrap(tensorType)),
----------------
ftynse wrote:

It looks strange to call the argument `tensorType` and expect a memref.

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


More information about the Mlir-commits mailing list