MLIR 22.0.0git
DialectAMDGPU.cpp
Go to the documentation of this file.
1//===--- DialectAMDGPU.cpp - Pybind module for AMDGPU 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"
13#include "nanobind/nanobind.h"
14
15namespace nb = nanobind;
16using namespace llvm;
17using namespace mlir;
18using namespace mlir::python;
20
21static void populateDialectAMDGPUSubmodule(const nb::module_ &m) {
22 auto amdgpuTDMBaseType =
25
26 amdgpuTDMBaseType.def_classmethod(
27 "get",
28 [](const nb::object &cls, MlirType elementType, MlirContext ctx) {
29 return cls(mlirAMDGPUTDMBaseTypeGet(ctx, elementType));
30 },
31 "Gets an instance of TDMBaseType in the same context", nb::arg("cls"),
32 nb::arg("element_type"), nb::arg("ctx") = nb::none());
33
34 auto amdgpuTDMDescriptorType = mlir_type_subclass(
35 m, "TDMDescriptorType", mlirTypeIsAAMDGPUTDMDescriptorType,
37
38 amdgpuTDMDescriptorType.def_classmethod(
39 "get",
40 [](const nb::object &cls, MlirContext ctx) {
41 return cls(mlirAMDGPUTDMDescriptorTypeGet(ctx));
42 },
43 "Gets an instance of TDMDescriptorType in the same context",
44 nb::arg("cls"), nb::arg("ctx") = nb::none());
45
46 auto amdgpuTDMGatherBaseType = mlir_type_subclass(
47 m, "TDMGatherBaseType", mlirTypeIsAAMDGPUTDMGatherBaseType,
49
50 amdgpuTDMGatherBaseType.def_classmethod(
51 "get",
52 [](const nb::object &cls, MlirType elementType, MlirType indexType,
53 MlirContext ctx) {
54 return cls(mlirAMDGPUTDMGatherBaseTypeGet(ctx, elementType, indexType));
55 },
56 "Gets an instance of TDMGatherBaseType in the same context",
57 nb::arg("cls"), nb::arg("element_type"), nb::arg("index_type"),
58 nb::arg("ctx") = nb::none());
59};
60
61NB_MODULE(_mlirDialectsAMDGPU, m) {
62 m.doc() = "MLIR AMDGPU dialect.";
63
65}
MLIR_CAPI_EXPORTED bool mlirTypeIsAAMDGPUTDMGatherBaseType(MlirType type)
Definition AMDGPU.cpp:55
MLIR_CAPI_EXPORTED bool mlirTypeIsAAMDGPUTDMDescriptorType(MlirType type)
Definition AMDGPU.cpp:39
MLIR_CAPI_EXPORTED MlirType mlirAMDGPUTDMGatherBaseTypeGet(MlirContext ctx, MlirType elementType, MlirType indexType)
Definition AMDGPU.cpp:63
MLIR_CAPI_EXPORTED MlirType mlirAMDGPUTDMDescriptorTypeGet(MlirContext ctx)
Definition AMDGPU.cpp:47
MLIR_CAPI_EXPORTED MlirTypeID mlirAMDGPUTDMDescriptorTypeGetTypeID()
Definition AMDGPU.cpp:43
MLIR_CAPI_EXPORTED bool mlirTypeIsAAMDGPUTDMBaseType(MlirType type)
Definition AMDGPU.cpp:23
MLIR_CAPI_EXPORTED MlirType mlirAMDGPUTDMBaseTypeGet(MlirContext ctx, MlirType elementType)
Definition AMDGPU.cpp:31
MLIR_CAPI_EXPORTED MlirTypeID mlirAMDGPUTDMBaseTypeGetTypeID()
Definition AMDGPU.cpp:27
MLIR_CAPI_EXPORTED MlirTypeID mlirAMDGPUTDMGatherBaseTypeGetTypeID()
Definition AMDGPU.cpp:59
static void populateDialectAMDGPUSubmodule(const nb::module_ &m)
NB_MODULE(_mlirDialectsAMDGPU, m)
Creates a custom subclass of mlir.ir.Type, implementing a casting constructor and type checking metho...
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:229
Include the generated interface declarations.