MLIR 24.0.0git
Async.h
Go to the documentation of this file.
1//===- Async.h - MLIR Async dialect -----------------------------*- C++ -*-===//
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//
9// This file defines the async dialect that is used for modeling asynchronous
10// execution.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_DIALECT_ASYNC_IR_ASYNC_H
15#define MLIR_DIALECT_ASYNC_IR_ASYNC_H
16
18#include "mlir/IR/Builders.h"
21
22//===----------------------------------------------------------------------===//
23// Async Dialect
24//===----------------------------------------------------------------------===//
25
26#include "mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc"
27
28//===----------------------------------------------------------------------===//
29// Async Dialect Operations
30//===----------------------------------------------------------------------===//
31
32#define GET_OP_CLASSES
33#include "mlir/Dialect/Async/IR/AsyncOps.h.inc"
34
35//===----------------------------------------------------------------------===//
36// Helper functions of Async dialect transformations.
37//===----------------------------------------------------------------------===//
38
39namespace mlir {
40namespace async {
41
42/// Returns true if the type is reference counted at runtime.
43inline bool isRefCounted(Type type) {
44 return isa<async::TokenType, ValueType, GroupType>(type);
45}
46
47} // namespace async
48} // namespace mlir
49
50namespace llvm {
51
52/// Allow stealing the low bits of async::FuncOp.
53template <>
54struct PointerLikeTypeTraits<mlir::async::FuncOp> {
55 static inline void *getAsVoidPointer(mlir::async::FuncOp val) {
56 return const_cast<void *>(val.getAsOpaquePointer());
57 }
58 static inline mlir::async::FuncOp getFromVoidPointer(void *p) {
59 return mlir::async::FuncOp::getFromOpaquePointer(p);
60 }
61 static constexpr int NumLowBitsAvailable = 3;
62};
63} // namespace llvm
64
65#endif // MLIR_DIALECT_ASYNC_IR_ASYNC_H
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:229
bool isRefCounted(Type type)
Returns true if the type is reference counted at runtime.
Definition Async.h:43
Include the generated interface declarations.
static void * getAsVoidPointer(mlir::async::FuncOp val)
Definition Async.h:55
static mlir::async::FuncOp getFromVoidPointer(void *p)
Definition Async.h:58