12#include "llvm/Support/Casting.h"
23 return isa<gpu::AsyncTokenType>(
unwrap(type));
39 return llvm::isa<gpu::ObjectAttr>(
unwrap(attr));
44 MlirAttribute mlirObjectProps) {
46 llvm::StringRef
object =
unwrap(objectStrRef);
47 DictionaryAttr objectProps;
48 if (mlirObjectProps.ptr !=
nullptr)
49 objectProps = llvm::cast<DictionaryAttr>(
unwrap(mlirObjectProps));
50 return wrap(gpu::ObjectAttr::get(
51 ctx,
unwrap(
target),
static_cast<gpu::CompilationTarget
>(format),
52 StringAttr::get(ctx,
object), objectProps,
nullptr));
56 return wrap(gpu::ObjectAttr::name);
63 MlirAttribute mlirObjectProps,
64 MlirAttribute mlirKernelsAttr) {
66 llvm::StringRef
object =
unwrap(objectStrRef);
67 DictionaryAttr objectProps;
68 if (mlirObjectProps.ptr !=
nullptr)
69 objectProps = llvm::cast<DictionaryAttr>(
unwrap(mlirObjectProps));
70 gpu::KernelTableAttr kernels;
71 if (mlirKernelsAttr.ptr !=
nullptr)
72 kernels = llvm::cast<gpu::KernelTableAttr>(
unwrap(mlirKernelsAttr));
73 return wrap(gpu::ObjectAttr::get(
74 ctx,
unwrap(
target),
static_cast<gpu::CompilationTarget
>(format),
75 StringAttr::get(ctx,
object), objectProps, kernels));
79 gpu::ObjectAttr objectAttr =
80 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
81 return wrap(objectAttr.getTarget());
85 gpu::ObjectAttr objectAttr =
86 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
87 return static_cast<uint32_t
>(objectAttr.getFormat());
91 gpu::ObjectAttr objectAttr =
92 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
93 llvm::StringRef
object = objectAttr.getObject();
98 gpu::ObjectAttr objectAttr =
99 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
100 return objectAttr.getProperties() !=
nullptr;
104 gpu::ObjectAttr objectAttr =
105 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
106 return wrap(objectAttr.getProperties());
110 gpu::ObjectAttr objectAttr =
111 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
112 return objectAttr.getKernels() !=
nullptr;
116 gpu::ObjectAttr objectAttr =
117 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
118 return wrap(objectAttr.getKernels());
MlirAttribute mlirGPUObjectAttrGetProperties(MlirAttribute mlirObjectAttr)
MlirAttribute mlirGPUObjectAttrGetTarget(MlirAttribute mlirObjectAttr)
MlirStringRef mlirGPUAsyncTokenTypeGetName(void)
bool mlirAttributeIsAGPUObjectAttr(MlirAttribute attr)
MlirAttribute mlirGPUObjectAttrGetKernels(MlirAttribute mlirObjectAttr)
MlirAttribute mlirGPUObjectAttrGetWithKernels(MlirContext mlirCtx, MlirAttribute target, uint32_t format, MlirStringRef objectStrRef, MlirAttribute mlirObjectProps, MlirAttribute mlirKernelsAttr)
MlirAttribute mlirGPUObjectAttrGet(MlirContext mlirCtx, MlirAttribute target, uint32_t format, MlirStringRef objectStrRef, MlirAttribute mlirObjectProps)
uint32_t mlirGPUObjectAttrGetFormat(MlirAttribute mlirObjectAttr)
bool mlirGPUObjectAttrHasKernels(MlirAttribute mlirObjectAttr)
MlirStringRef mlirGPUObjectAttrGetName(void)
MlirType mlirGPUAsyncTokenTypeGet(MlirContext ctx)
bool mlirGPUObjectAttrHasProperties(MlirAttribute mlirObjectAttr)
MlirStringRef mlirGPUObjectAttrGetObject(MlirAttribute mlirObjectAttr)
MLIR_CAPI_EXPORTED bool mlirTypeIsAGPUAsyncTokenType(MlirType type)
#define MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Name, Namespace, ClassName)
MLIRContext is the top-level object for a collection of MLIR operations.
static ConcreteType get(MLIRContext *ctx, Args &&...args)
static constexpr StringLiteral name
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
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.