MLIR 22.0.0git
DialectNVGPU.cpp
Go to the documentation of this file.
1//===--- DialectNVGPU.cpp - Pybind module for NVGPU dialect API support ---===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "mlir-c/IR.h"
14
15namespace nb = nanobind;
16using namespace llvm;
18
19namespace mlir {
20namespace python {
22namespace nvgpu {
23struct TensorMapDescriptorType : PyConcreteType<TensorMapDescriptorType> {
24 static constexpr IsAFunctionTy isaFunction =
26 static constexpr const char *pyClassName = "TensorMapDescriptorType";
27 static inline const MlirStringRef name =
29 using Base::Base;
30
31 static void bindDerived(ClassTy &c) {
32 c.def_static(
33 "get",
34 [](const PyType &tensorMemrefType, int swizzle, int l2promo,
35 int oobFill, int interleave, DefaultingPyMlirContext context) {
37 context->getRef(), mlirNVGPUTensorMapDescriptorTypeGet(
38 context.get()->get(), tensorMemrefType,
39 swizzle, l2promo, oobFill, interleave));
40 },
41 "Gets an instance of TensorMapDescriptorType in the same context",
42 nb::arg("tensor_type"), nb::arg("swizzle"), nb::arg("l2promo"),
43 nb::arg("oob_fill"), nb::arg("interleave"),
44 nb::arg("context").none() = nb::none());
45 }
46};
47} // namespace nvgpu
48} // namespace MLIR_BINDINGS_PYTHON_DOMAIN
49} // namespace python
50} // namespace mlir
51
52NB_MODULE(_mlirDialectsNVGPU, m) {
53 m.doc() = "MLIR NVGPU dialect.";
54
56 bind(m);
57}
NB_MODULE(_mlirDialectsNVGPU, m)
MLIR_CAPI_EXPORTED bool mlirTypeIsANVGPUTensorMapDescriptorType(MlirType type)
Definition NVGPU.cpp:19
MLIR_CAPI_EXPORTED MlirType mlirNVGPUTensorMapDescriptorTypeGet(MlirContext ctx, MlirType tensorMemrefType, int swizzle, int l2promo, int oobFill, int interleave)
Definition NVGPU.cpp:23
MLIR_CAPI_EXPORTED MlirStringRef mlirNVGPUTensorMapDescriptorTypeGetName(void)
Definition NVGPU.cpp:33
ReferrentTy * get() const
Used in function arguments when None should resolve to the current context manager set instance.
Definition IRCore.h:280
nanobind::class_< TensorMapDescriptorType, PyType > ClassTy
Definition IRCore.h:933
PyType(PyMlirContextRef contextRef, MlirType type)
Definition IRCore.h:878
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:229
Include the generated interface declarations.
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition Support.h:75