MLIR 24.0.0git
ACCToLLVMUtils.h File Reference
#include "mlir/Dialect/OpenACC/Analysis/OpenACCSupport.h"
#include "mlir/Dialect/OpenACC/OpenACCRuntimeUtils.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Region.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/StringRef.h"
#include <optional>
#include <string>
#include <utility>

Go to the source code of this file.

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::acc
namespace  mlir::acc::detail

Typedefs

template<typename OpTy>
using mlir::acc::detail::has_device_type_clauses_t
 The constructs carrying a device_type clause hold their async and wait clauses per device type.
template<typename OpTy>
using mlir::acc::detail::has_async_only_t = decltype(std::declval<OpTy>().getAsyncOnly())
template<typename OpTy>
using mlir::acc::detail::has_wait_only_t = decltype(std::declval<OpTy>().getWaitOnly())

Functions

Location mlir::acc::unfuseLoc (Location loc)
 Unfuses fused locations, returning the last sub-location.
std::optional< FileLineColLoc > mlir::acc::getFileLineColLoc (Location loc, bool errorOnInvalidLocation)
 Returns file:line:column location information when available.
StringRef mlir::acc::getParentFunctionName (Operation *op)
 Returns the symbol name of the function op belongs to, or of op itself when it is a function.
StringRef mlir::acc::getParentFunctionName (Value value)
 Returns the enclosing function symbol name for value's defining op.
StringRef mlir::acc::getParentFunctionName (ValueRange values)
 Returns the first non-empty enclosing function name from values.
std::string mlir::acc::getInternalGlobalName (StringRef kind, StringRef detail)
 Returns the name to give a global that the conversion creates to hold detail of kind, such as the name of a variable or a source position.
Value mlir::acc::getOrCreateGlobalString (Location loc, OpBuilder &builder, StringRef name, StringRef value, Region &globalSymbolRegion, SymbolTable *symbolTable=nullptr)
 Creates or reuses a null-terminated string global in globalSymbolRegion.
Value mlir::acc::createIdent (Location loc, StringRef functionName, OpBuilder &builder, Region &globalSymbolRegion, const ACCRuntimeCallConfig &config, SymbolTable *symbolTable=nullptr)
 Returns a pointer to a constant global holding an ident_t for OpenACC runtime calls.
Value mlir::acc::castToI64 (Location loc, Value value, OpBuilder &builder)
 Sign-extends or truncates value to the i64 the runtime entry points take for values like queue numbers.
Value mlir::acc::getAsyncQueue (Location loc, Value asyncOperand, bool asyncOnly, OpBuilder &builder, const ACCRuntimeCallConfig &config)
 Returns the queue an async clause selects: the value of the clause when it has one, the queue standing for an async clause without a value when asyncOnly is set, and the synchronous queue when there is no clause at all.
LogicalResult mlir::acc::emitWaitCall (Location loc, ValueRange waitOperands, Value asyncQueue, OpBuilder &builder, Region &globalSymbolRegion, SymbolTable &symbolTable, const ACCRuntimeCallConfig &config, Value deviceNum={})
 Emits the runtime call that waits for waitOperands on asyncQueue, which is what a wait clause or an acc.wait directive asks for.
FailureOr< Value > mlir::acc::emitGetDevicePtrCall (Operation *clauseOp, Value hostPtr, bool ifPresent, OpBuilder &builder, Region &globalSymbolRegion, SymbolTable &symbolTable, const ACCRuntimeCallConfig &config)
 Emits the runtime call that asks for the device address the object of the data clause clauseOp is mapped to, which is what a use_device clause exposes in the body of its construct.
LogicalResult mlir::acc::emitGuardedByIfCond (Location loc, Value ifCond, RewriterBase &rewriter, function_ref< LogicalResult()> emitFn)
 Runs emitFn guarded by a branch on ifCond, or unguarded when there is no condition.
FailureOr< Value > mlir::acc::emitValueSelectedByIfCond (Location loc, Value ifCond, RewriterBase &rewriter, function_ref< FailureOr< Value >()> thenFn, function_ref< FailureOr< Value >()> elseFn)
 Emits thenFn on the path a branch on ifCond takes and elseFn on the other one, and returns the value that reaches the code following the branch.
void mlir::acc::spliceConstructRegion (Operation *op, Region &region, RewriterBase &rewriter)
 Splices region, the body of a structured construct, into the block holding op, so that the construct itself can be erased.
SmallVector< DeviceType, 3 > mlir::acc::getDeviceTypesByPrecedence (DeviceType deviceType)
 The clauses of a construct can be given once per device type.
template<typename OpTy>
Value mlir::acc::getAsyncClauseValue (OpTy op, DeviceType deviceType, bool &asyncOnly)
 Returns the value the async clause of op names for deviceType, and sets asyncOnly when the clause names no queue.
template<typename OpTy>
std::optional< DeviceType > mlir::acc::getWaitClauseValues (OpTy op, DeviceType deviceType, SmallVectorImpl< Value > &waitValues)
 Appends to waitValues the queues the wait clause of op names for deviceType, and returns the device type the clause naming them is given for - a clause naming no queue waits for every one of them.
template<typename OpTy>
bool mlir::acc::hasWaitDevnum (OpTy op, DeviceType deviceType)
 Returns whether the wait clause op gives for deviceType carries a devnum modifier, which selects the device the queues belong to.
template<typename OpTy>
Value mlir::acc::getAsyncQueue (OpTy op, DeviceType deviceType, ConversionPatternRewriter &rewriter, const ACCRuntimeCallConfig &config)
 Returns the queue that the runtime calls of op run on, from the async clause it gives for deviceType.
template<typename OpTy>
LogicalResult mlir::acc::emitWaitClause (OpTy op, DeviceType deviceType, Value asyncQueue, ConversionPatternRewriter &rewriter, OpenACCSupport &accSupport, Region &globalSymbolRegion, SymbolTable &symbolTable, const ACCRuntimeCallConfig &config)
 Emits the wait that a wait clause on op asks for before the runtime calls of the construct, waiting on asyncQueue for the queues the clause names, or for every queue when it names none.