12 #include "llvm/Support/Casting.h"
23 return isa<gpu::AsyncTokenType>(
unwrap(type));
35 return llvm::isa<gpu::ObjectAttr>(
unwrap(attr));
40 MlirAttribute mlirObjectProps) {
42 llvm::StringRef
object =
unwrap(objectStrRef);
43 DictionaryAttr objectProps;
44 if (mlirObjectProps.ptr !=
nullptr)
45 objectProps = llvm::cast<DictionaryAttr>(
unwrap(mlirObjectProps));
47 ctx,
unwrap(target),
static_cast<gpu::CompilationTarget
>(format),
55 MlirAttribute mlirObjectProps,
56 MlirAttribute mlirKernelsAttr) {
58 llvm::StringRef
object =
unwrap(objectStrRef);
59 DictionaryAttr objectProps;
60 if (mlirObjectProps.ptr !=
nullptr)
61 objectProps = llvm::cast<DictionaryAttr>(
unwrap(mlirObjectProps));
62 gpu::KernelTableAttr kernels;
63 if (mlirKernelsAttr.ptr !=
nullptr)
64 kernels = llvm::cast<gpu::KernelTableAttr>(
unwrap(mlirKernelsAttr));
66 ctx,
unwrap(target),
static_cast<gpu::CompilationTarget
>(format),
71 gpu::ObjectAttr objectAttr =
72 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
73 return wrap(objectAttr.getTarget());
77 gpu::ObjectAttr objectAttr =
78 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
79 return static_cast<uint32_t
>(objectAttr.getFormat());
83 gpu::ObjectAttr objectAttr =
84 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
85 llvm::StringRef
object = objectAttr.getObject();
90 gpu::ObjectAttr objectAttr =
91 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
92 return objectAttr.getProperties() !=
nullptr;
96 gpu::ObjectAttr objectAttr =
97 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
98 return wrap(objectAttr.getProperties());
102 gpu::ObjectAttr objectAttr =
103 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
104 return objectAttr.getKernels() !=
nullptr;
108 gpu::ObjectAttr objectAttr =
109 llvm::cast<gpu::ObjectAttr>(
unwrap(mlirObjectAttr));
110 return wrap(objectAttr.getKernels());
MlirAttribute mlirGPUObjectAttrGetProperties(MlirAttribute mlirObjectAttr)
MlirAttribute mlirGPUObjectAttrGetTarget(MlirAttribute mlirObjectAttr)
bool mlirTypeIsAGPUAsyncTokenType(MlirType type)
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)
MlirType mlirGPUAsyncTokenTypeGet(MlirContext ctx)
bool mlirGPUObjectAttrHasProperties(MlirAttribute mlirObjectAttr)
MlirStringRef mlirGPUObjectAttrGetObject(MlirAttribute mlirObjectAttr)
#define MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Name, Namespace, ClassName)
MLIRContext is the top-level object for a collection of MLIR operations.
static ConcreteT get(MLIRContext *ctx, Args &&...args)
Get or create a new ConcreteT instance within the ctx.
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
static MlirStringRef mlirStringRefCreate(const char *str, size_t length)
Constructs a string reference from the pointer and length.
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
A pointer to a sized fragment of a string, not necessarily null-terminated.