MLIR  19.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 
19 #include "mlir/IR/Builders.h"
20 #include "mlir/IR/BuiltinTypes.h"
21 #include "mlir/IR/Dialect.h"
23 #include "mlir/IR/PatternMatch.h"
24 #include "mlir/IR/SymbolTable.h"
30 
31 //===----------------------------------------------------------------------===//
32 // Async Dialect
33 //===----------------------------------------------------------------------===//
34 
35 #include "mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc"
36 
37 //===----------------------------------------------------------------------===//
38 // Async Dialect Operations
39 //===----------------------------------------------------------------------===//
40 
41 #define GET_OP_CLASSES
42 #include "mlir/Dialect/Async/IR/AsyncOps.h.inc"
43 
44 //===----------------------------------------------------------------------===//
45 // Helper functions of Async dialect transformations.
46 //===----------------------------------------------------------------------===//
47 
48 namespace mlir {
49 namespace async {
50 
51 /// Returns true if the type is reference counted at runtime.
52 inline bool isRefCounted(Type type) {
53  return isa<TokenType, ValueType, GroupType>(type);
54 }
55 
56 } // namespace async
57 } // namespace mlir
58 
59 namespace llvm {
60 
61 /// Allow stealing the low bits of async::FuncOp.
62 template <>
63 struct PointerLikeTypeTraits<mlir::async::FuncOp> {
64  static inline void *getAsVoidPointer(mlir::async::FuncOp val) {
65  return const_cast<void *>(val.getAsOpaquePointer());
66  }
67  static inline mlir::async::FuncOp getFromVoidPointer(void *p) {
68  return mlir::async::FuncOp::getFromOpaquePointer(p);
69  }
70  static constexpr int numLowBitsAvailable = 3;
71 };
72 } // namespace llvm
73 
74 #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
Include the generated interface declarations.
Definition: CallGraph.h:229
bool isRefCounted(Type type)
Returns true if the type is reference counted at runtime.
Definition: Async.h:52
Include the generated interface declarations.
static void * getAsVoidPointer(mlir::async::FuncOp val)
Definition: Async.h:64
static mlir::async::FuncOp getFromVoidPointer(void *p)
Definition: Async.h:67