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 
17 #include "mlir/IR/Builders.h"
18 #include "mlir/IR/Dialect.h"
19 #include "mlir/IR/OpDefinition.h"
20 #include "mlir/IR/OpImplementation.h"
21 #include "mlir/IR/StandardTypes.h"
22 #include "mlir/Interfaces/ControlFlowInterfaces.h"
23 #include "mlir/Interfaces/SideEffectInterfaces.h"
24 
25 namespace mlir {
26 namespace async {
27 
28 namespace detail {
29 struct ValueTypeStorage;
30 } // namespace detail
31 
32 /// The token type to represent asynchronous operation completion.
33 class TokenType : public Type::TypeBase<TokenType, Type, TypeStorage> {
34 public:
35   using Base::Base;
36 };
37 
38 /// The value type to represent values returned from asynchronous operations.
39 class ValueType
40     : public Type::TypeBase<ValueType, Type, detail::ValueTypeStorage> {
41 public:
42   using Base::Base;
43 
44   /// Get or create an async ValueType with the provided value type.
45   static ValueType get(Type valueType);
46 
47   Type getValueType();
48 };
49 
50 } // namespace async
51 } // namespace mlir
52 
53 #define GET_OP_CLASSES
54 #include "mlir/Dialect/Async/IR/AsyncOps.h.inc"
55 
56 #include "mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc"
57 
58 #endif // MLIR_DIALECT_ASYNC_IR_ASYNC_H
59