MLIR  15.0.0git
Macros | Functions | Variables
AsyncToLLVM.cpp File Reference
#include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
#include "../PassDetail.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/LLVMIR/FunctionCallUtils.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/TypeSwitch.h"
+ Include dependency graph for AsyncToLLVM.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "convert-async-to-llvm"
 

Functions

static void addAsyncRuntimeApiDeclarations (ModuleOp module)
 Adds Async Runtime C API declarations to the module. More...
 
static void addResumeFunction (ModuleOp module)
 A function that takes a coroutine handle and calls a llvm.coro.resume intrinsics. More...
 

Variables

static constexpr const char * kAddRef = "mlirAsyncRuntimeAddRef"
 
static constexpr const char * kDropRef = "mlirAsyncRuntimeDropRef"
 
static constexpr const char * kCreateToken = "mlirAsyncRuntimeCreateToken"
 
static constexpr const char * kCreateValue = "mlirAsyncRuntimeCreateValue"
 
static constexpr const char * kCreateGroup = "mlirAsyncRuntimeCreateGroup"
 
static constexpr const char * kEmplaceToken = "mlirAsyncRuntimeEmplaceToken"
 
static constexpr const char * kEmplaceValue = "mlirAsyncRuntimeEmplaceValue"
 
static constexpr const char * kSetTokenError = "mlirAsyncRuntimeSetTokenError"
 
static constexpr const char * kSetValueError = "mlirAsyncRuntimeSetValueError"
 
static constexpr const char * kIsTokenError = "mlirAsyncRuntimeIsTokenError"
 
static constexpr const char * kIsValueError = "mlirAsyncRuntimeIsValueError"
 
static constexpr const char * kIsGroupError = "mlirAsyncRuntimeIsGroupError"
 
static constexpr const char * kAwaitToken = "mlirAsyncRuntimeAwaitToken"
 
static constexpr const char * kAwaitValue = "mlirAsyncRuntimeAwaitValue"
 
static constexpr const char * kAwaitGroup = "mlirAsyncRuntimeAwaitAllInGroup"
 
static constexpr const char * kExecute = "mlirAsyncRuntimeExecute"
 
static constexpr const char * kGetValueStorage
 
static constexpr const char * kAddTokenToGroup
 
static constexpr const char * kAwaitTokenAndExecute
 
static constexpr const char * kAwaitValueAndExecute
 
static constexpr const char * kAwaitAllAndExecute
 
static constexpr const char * kGetNumWorkerThreads
 
static constexpr const char * kResume = "__resume"
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "convert-async-to-llvm"

Definition at line 27 of file AsyncToLLVM.cpp.

Function Documentation

◆ addAsyncRuntimeApiDeclarations()

static void addAsyncRuntimeApiDeclarations ( ModuleOp  module)
static

◆ addResumeFunction()

static void addResumeFunction ( ModuleOp  module)
static

A function that takes a coroutine handle and calls a llvm.coro.resume intrinsics.

We need this function to be able to pass it to the async runtime execute API.

Definition at line 247 of file AsyncToLLVM.cpp.

References addAsyncRuntimeApiDeclarations(), mlir::TypeConverter::addConversion(), mlir::applyPartialConversion(), mlir::ImplicitLocOpBuilder::atBlockEnd(), mlir::OpBuilder::cloneWithoutRegions(), mlir::ConversionPatternRewriter::convertRegionTypes(), mlir::TypeConverter::convertType(), mlir::OpBuilder::create(), mlir::Type::dyn_cast(), mlir::ConversionPatternRewriter::eraseOp(), mlir::failed(), mlir::failure(), mlir::LLVM::LLVMFunctionType::get(), mlir::LLVM::LLVMPointerType::get(), mlir::Builder::getBoolAttr(), mlir::Builder::getContext(), mlir::Type::getContext(), mlir::Builder::getI1Type(), mlir::Builder::getI32IntegerAttr(), mlir::Builder::getI32Type(), mlir::Builder::getI64IntegerAttr(), mlir::Builder::getI64Type(), mlir::Builder::getIndexType(), mlir::Builder::getIntegerType(), mlir::Value::getLoc(), mlir::ConversionPatternRewriter::inlineRegionBefore(), mlir::Type::isa(), kAddRef, kAddTokenToGroup, kAwaitAllAndExecute, kAwaitGroup, kAwaitToken, kAwaitTokenAndExecute, kAwaitValue, kAwaitValueAndExecute, kCreateGroup, kCreateToken, kCreateValue, kDropRef, kEmplaceToken, kEmplaceValue, kExecute, kGetNumWorkerThreads, kGetValueStorage, kIsGroupError, kIsTokenError, kIsValueError, kResume, kSetTokenError, kSetValueError, mlir::LLVM::lookupOrCreateAlignedAllocFn(), mlir::LLVM::lookupOrCreateFreeFn(), mlir::ConversionPatternRewriter::notifyMatchFailure(), mlir::OpConversionPattern< SourceOp >::OpConversionPattern(), mlir::populateCallOpTypeConversionPattern(), mlir::ConversionPatternRewriter::replaceOp(), mlir::RewriterBase::replaceOpWithNewOp(), mlir::success(), and value.

Variable Documentation

◆ kAddRef

constexpr const char* kAddRef = "mlirAsyncRuntimeAddRef"
static

Definition at line 36 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kAddTokenToGroup

constexpr const char* kAddTokenToGroup
static
Initial value:
=
"mlirAsyncRuntimeAddTokenToGroup"

Definition at line 54 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kAwaitAllAndExecute

constexpr const char* kAwaitAllAndExecute
static
Initial value:
=
"mlirAsyncRuntimeAwaitAllInGroupAndExecute"

Definition at line 60 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kAwaitGroup

constexpr const char* kAwaitGroup = "mlirAsyncRuntimeAwaitAllInGroup"
static

Definition at line 50 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kAwaitToken

constexpr const char* kAwaitToken = "mlirAsyncRuntimeAwaitToken"
static

Definition at line 48 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kAwaitTokenAndExecute

constexpr const char* kAwaitTokenAndExecute
static
Initial value:
=
"mlirAsyncRuntimeAwaitTokenAndExecute"

Definition at line 56 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kAwaitValue

constexpr const char* kAwaitValue = "mlirAsyncRuntimeAwaitValue"
static

Definition at line 49 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kAwaitValueAndExecute

constexpr const char* kAwaitValueAndExecute
static
Initial value:
=
"mlirAsyncRuntimeAwaitValueAndExecute"

Definition at line 58 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kCreateGroup

constexpr const char* kCreateGroup = "mlirAsyncRuntimeCreateGroup"
static

Definition at line 40 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kCreateToken

constexpr const char* kCreateToken = "mlirAsyncRuntimeCreateToken"
static

Definition at line 38 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kCreateValue

constexpr const char* kCreateValue = "mlirAsyncRuntimeCreateValue"
static

Definition at line 39 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kDropRef

constexpr const char* kDropRef = "mlirAsyncRuntimeDropRef"
static

Definition at line 37 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kEmplaceToken

constexpr const char* kEmplaceToken = "mlirAsyncRuntimeEmplaceToken"
static

Definition at line 41 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kEmplaceValue

constexpr const char* kEmplaceValue = "mlirAsyncRuntimeEmplaceValue"
static

Definition at line 42 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kExecute

constexpr const char* kExecute = "mlirAsyncRuntimeExecute"
static

Definition at line 51 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kGetNumWorkerThreads

constexpr const char* kGetNumWorkerThreads
static
Initial value:
=
"mlirAsyncRuntimGetNumWorkerThreads"

Definition at line 62 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kGetValueStorage

constexpr const char* kGetValueStorage
static
Initial value:
=
"mlirAsyncRuntimeGetValueStorage"

Definition at line 52 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kIsGroupError

constexpr const char* kIsGroupError = "mlirAsyncRuntimeIsGroupError"
static

Definition at line 47 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kIsTokenError

constexpr const char* kIsTokenError = "mlirAsyncRuntimeIsTokenError"
static

Definition at line 45 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kIsValueError

constexpr const char* kIsValueError = "mlirAsyncRuntimeIsValueError"
static

Definition at line 46 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kResume

constexpr const char* kResume = "__resume"
static

Definition at line 242 of file AsyncToLLVM.cpp.

Referenced by addResumeFunction().

◆ kSetTokenError

constexpr const char* kSetTokenError = "mlirAsyncRuntimeSetTokenError"
static

Definition at line 43 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().

◆ kSetValueError

constexpr const char* kSetValueError = "mlirAsyncRuntimeSetValueError"
static

Definition at line 44 of file AsyncToLLVM.cpp.

Referenced by addAsyncRuntimeApiDeclarations(), and addResumeFunction().