16 using namespace nanobind::literals;
27 m.doc() =
"MLIR GPU Dialect";
32 auto mlirGPUAsyncTokenType =
35 mlirGPUAsyncTokenType.def_classmethod(
37 [](
const nb::object &cls, MlirContext ctx) {
40 "Gets an instance of AsyncTokenType in the same context", nb::arg(
"cls"),
41 nb::arg(
"ctx") = nb::none());
50 [](
const nb::object &cls, MlirAttribute target, uint32_t format,
51 const nb::bytes &
object,
52 std::optional<MlirAttribute> mlirObjectProps,
53 std::optional<MlirAttribute> mlirKernelsAttr) {
55 static_cast<char *
>(
const_cast<void *
>(
object.data())),
59 mlirObjectProps.has_value() ? *mlirObjectProps
60 : MlirAttribute{nullptr},
61 mlirKernelsAttr.has_value() ? *mlirKernelsAttr
62 : MlirAttribute{nullptr}));
64 "cls"_a,
"target"_a,
"format"_a,
"object"_a,
65 "properties"_a = nb::none(),
"kernels"_a = nb::none(),
66 "Gets a gpu.object from parameters.")
67 .def_property_readonly(
70 .def_property_readonly(
73 .def_property_readonly(
75 [](MlirAttribute
self) {
77 return nb::bytes(stringRef.
data, stringRef.
length);
79 .def_property_readonly(
"properties",
80 [](MlirAttribute
self) -> nb::object {
86 .def_property_readonly(
"kernels", [](MlirAttribute
self) -> nb::object {
NB_MODULE(_mlirDialectsGPU, m)
MLIR_CAPI_EXPORTED bool mlirAttributeIsAGPUObjectAttr(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirGPUObjectAttrGetTarget(MlirAttribute mlirObjectAttr)
MLIR_CAPI_EXPORTED MlirAttribute mlirGPUObjectAttrGetProperties(MlirAttribute mlirObjectAttr)
MLIR_CAPI_EXPORTED bool mlirGPUObjectAttrHasProperties(MlirAttribute mlirObjectAttr)
MLIR_CAPI_EXPORTED MlirAttribute mlirGPUObjectAttrGetKernels(MlirAttribute mlirObjectAttr)
MLIR_CAPI_EXPORTED MlirAttribute mlirGPUObjectAttrGetWithKernels(MlirContext mlirCtx, MlirAttribute target, uint32_t format, MlirStringRef objectStrRef, MlirAttribute mlirObjectProps, MlirAttribute mlirKernelsAttr)
MLIR_CAPI_EXPORTED bool mlirGPUObjectAttrHasKernels(MlirAttribute mlirObjectAttr)
MLIR_CAPI_EXPORTED MlirType mlirGPUAsyncTokenTypeGet(MlirContext ctx)
MLIR_CAPI_EXPORTED bool mlirTypeIsAGPUAsyncTokenType(MlirType type)
MLIR_CAPI_EXPORTED uint32_t mlirGPUObjectAttrGetFormat(MlirAttribute mlirObjectAttr)
MLIR_CAPI_EXPORTED MlirStringRef mlirGPUObjectAttrGetObject(MlirAttribute mlirObjectAttr)
Creates a custom subclass of mlir.ir.Attribute, implementing a casting constructor and type checking ...
Creates a custom subclass of mlir.ir.Type, implementing a casting constructor and type checking metho...
pure_subclass & def_classmethod(const char *name, Func &&f, const Extra &...extra)
MLIR_CAPI_EXPORTED MlirContext mlirAttributeGetContext(MlirAttribute attribute)
Gets the context that an attribute was created with.
static MlirStringRef mlirStringRefCreate(const char *str, size_t length)
Constructs a string reference from the pointer and length.
Include the generated interface declarations.
A pointer to a sized fragment of a string, not necessarily null-terminated.
const char * data
Pointer to the first symbol.
size_t length
Length of the fragment.