This PR fixed [issues](https://github.com/iree-org/iree/actions/runs/21956878131/job/63423389868#step:7:211) caused by dropping `LLVMSupport` in PR #180986, dropped the remaining direct llvm dependencies from mlir-python binding files. Previously `LLVMSupport` was dropped while some uncleaned `mlir/CAPI/*` sources were still being pulled into mlir-py, and those files still directly depended on LLVM headers. The issue was masked via a global `include_directories(${LLVM_INCLUDE_DIRS})` in `mlir/CMakeLists.txt`, out-of-tree builds (e.g., IREE) that define Python module targets outside the mlir/ directory tree would fail with "no such llvm file" errors.
57 lines
2.1 KiB
C++
57 lines
2.1 KiB
C++
//===--- DialectNVGPU.cpp - Pybind module for NVGPU dialect API support ---===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir-c/Dialect/NVGPU.h"
|
|
#include "mlir-c/IR.h"
|
|
#include "mlir/Bindings/Python/IRCore.h"
|
|
#include "mlir/Bindings/Python/Nanobind.h"
|
|
#include "mlir/Bindings/Python/NanobindAdaptors.h"
|
|
|
|
namespace nb = nanobind;
|
|
using namespace mlir::python::nanobind_adaptors;
|
|
|
|
namespace mlir {
|
|
namespace python {
|
|
namespace MLIR_BINDINGS_PYTHON_DOMAIN {
|
|
namespace nvgpu {
|
|
struct TensorMapDescriptorType : PyConcreteType<TensorMapDescriptorType> {
|
|
static constexpr IsAFunctionTy isaFunction =
|
|
mlirTypeIsANVGPUTensorMapDescriptorType;
|
|
static constexpr const char *pyClassName = "TensorMapDescriptorType";
|
|
static inline const MlirStringRef name =
|
|
mlirNVGPUTensorMapDescriptorTypeGetName();
|
|
using Base::Base;
|
|
|
|
static void bindDerived(ClassTy &c) {
|
|
c.def_static(
|
|
"get",
|
|
[](const PyType &tensorMemrefType, int swizzle, int l2promo,
|
|
int oobFill, int interleave, DefaultingPyMlirContext context) {
|
|
return TensorMapDescriptorType(
|
|
context->getRef(), mlirNVGPUTensorMapDescriptorTypeGet(
|
|
context.get()->get(), tensorMemrefType,
|
|
swizzle, l2promo, oobFill, interleave));
|
|
},
|
|
"Gets an instance of TensorMapDescriptorType in the same context",
|
|
nb::arg("tensor_type"), nb::arg("swizzle"), nb::arg("l2promo"),
|
|
nb::arg("oob_fill"), nb::arg("interleave"),
|
|
nb::arg("context").none() = nb::none());
|
|
}
|
|
};
|
|
} // namespace nvgpu
|
|
} // namespace MLIR_BINDINGS_PYTHON_DOMAIN
|
|
} // namespace python
|
|
} // namespace mlir
|
|
|
|
NB_MODULE(_mlirDialectsNVGPU, m) {
|
|
m.doc() = "MLIR NVGPU dialect.";
|
|
|
|
mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::nvgpu::TensorMapDescriptorType::
|
|
bind(m);
|
|
}
|