MLIR 23.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;
17
18namespace mlir {
19namespace python {
21namespace nvgpu {
22struct TensorMapDescriptorType : PyConcreteType<TensorMapDescriptorType> {
23 static constexpr IsAFunctionTy isaFunction =
25 static constexpr const char *pyClassName = "TensorMapDescriptorType";
26 static inline const MlirStringRef name =
28 using Base::Base;
29
30 static void bindDerived(ClassTy &c) {
31 c.def_static(
32 "get",
33 [](const PyType &tensorMemrefType, int swizzle, int l2promo,
34 int oobFill, int interleave, DefaultingPyMlirContext context) {
36 context->getRef(), mlirNVGPUTensorMapDescriptorTypeGet(
37 context.get()->get(), tensorMemrefType,
38 swizzle, l2promo, oobFill, interleave));
39 },
40 "Gets an instance of TensorMapDescriptorType in the same context",
41 nb::arg("tensor_type"), nb::arg("swizzle"), nb::arg("l2promo"),
42 nb::arg("oob_fill"), nb::arg("interleave"),
43 nb::arg("context").none() = nb::none());
44 }
45};
46} // namespace nvgpu
47} // namespace MLIR_BINDINGS_PYTHON_DOMAIN
48} // namespace python
49} // namespace mlir
50
51NB_MODULE(_mlirDialectsNVGPU, m) {
52 m.doc() = "MLIR NVGPU dialect.";
53
55 bind(m);
56}
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:278
nanobind::class_< TensorMapDescriptorType, PyType > ClassTy
Definition IRCore.h:931
PyType(PyMlirContextRef contextRef, MlirType type)
Definition IRCore.h:876
Include the generated interface declarations.
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition Support.h:78