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