16 #include "llvm/ADT/SmallVectorExtras.h"
17 #include "llvm/ADT/StringSet.h"
18 #include "llvm/Support/FormatVariadic.h"
28 workgroupBuffers.reserve(gpuFuncOp.getNumWorkgroupAttributions());
29 for (
const auto [idx, attribution] :
31 auto type = dyn_cast<MemRefType>(attribution.getType());
32 assert(type && type.hasStaticShape() &&
"unexpected type in attribution");
34 uint64_t numElements = type.getNumElements();
40 std::string(llvm::formatv(
"__wg_{0}_{1}", gpuFuncOp.getName(), idx));
41 uint64_t alignment = 0;
43 dyn_cast_or_null<IntegerAttr>(gpuFuncOp.getWorkgroupAttributionAttr(
44 idx, LLVM::LLVMDialect::getAlignAttrName())))
45 alignment = alignAttr.getInt();
46 auto globalOp = rewriter.
create<LLVM::GlobalOp>(
47 gpuFuncOp.getLoc(), arrayType,
false,
48 LLVM::Linkage::Internal, name,
Attribute(), alignment,
50 workgroupBuffers.push_back(globalOp);
55 gpuFuncOp.front().getNumArguments());
58 gpuFuncOp.getFunctionType(),
false,
62 diag <<
"failed to convert function signature type for: "
63 << gpuFuncOp.getFunctionType();
71 for (
const auto &attr : gpuFuncOp->getAttrs()) {
73 attr.getName() == gpuFuncOp.getFunctionTypeAttrName() ||
75 gpu::GPUFuncOp::getNumWorkgroupAttributionsAttrName() ||
76 attr.getName() == gpuFuncOp.getWorkgroupAttribAttrsAttrName() ||
77 attr.getName() == gpuFuncOp.getPrivateAttribAttrsAttrName() ||
78 attr.getName() == gpuFuncOp.getKnownBlockSizeAttrName() ||
79 attr.getName() == gpuFuncOp.getKnownGridSizeAttrName())
81 if (attr.getName() == gpuFuncOp.getArgAttrsAttrName()) {
82 argAttrs = gpuFuncOp.getArgAttrsAttr();
85 attributes.push_back(attr);
92 auto *gpuDialect = cast<gpu::GPUDialect>(gpuFuncOp->getDialect());
94 attributes.emplace_back(gpuDialect->getKnownBlockSizeAttrHelper().getName(),
97 attributes.emplace_back(gpuDialect->getKnownGridSizeAttrHelper().getName(),
103 if (gpuFuncOp.isKernel()) {
104 attributes.emplace_back(kernelAttributeName, rewriter.
getUnitAttr());
106 if (kernelBlockSizeAttributeName.has_value() && knownBlockSize) {
107 attributes.emplace_back(kernelBlockSizeAttributeName.value(),
111 auto llvmFuncOp = rewriter.
create<LLVM::LLVMFuncOp>(
112 gpuFuncOp.getLoc(), gpuFuncOp.getName(), funcType,
113 LLVM::Linkage::External,
false, LLVM::CConv::C,
114 nullptr, attributes);
126 unsigned numProperArguments = gpuFuncOp.getNumArguments();
130 global.getAddrSpace());
131 Value address = rewriter.
create<LLVM::AddressOfOp>(
132 loc, ptrType, global.getSymNameAttr());
134 rewriter.
create<LLVM::GEPOp>(loc, ptrType, global.getType(), address,
141 Value attribution = gpuFuncOp.getWorkgroupAttributions()[idx];
142 auto type = cast<MemRefType>(attribution.getType());
145 signatureConversion.
remapInput(numProperArguments + idx, descr);
149 unsigned numWorkgroupAttributions = gpuFuncOp.getNumWorkgroupAttributions();
151 for (
const auto [idx, attribution] :
153 auto type = cast<MemRefType>(attribution.getType());
154 assert(type && type.hasStaticShape() &&
"unexpected type in attribution");
162 Value numElements = rewriter.
create<LLVM::ConstantOp>(
163 gpuFuncOp.getLoc(), int64Ty, type.getNumElements());
164 uint64_t alignment = 0;
166 dyn_cast_or_null<IntegerAttr>(gpuFuncOp.getPrivateAttributionAttr(
167 idx, LLVM::LLVMDialect::getAlignAttrName())))
168 alignment = alignAttr.getInt();
170 gpuFuncOp.getLoc(), ptrType, elementType, numElements, alignment);
174 numProperArguments + numWorkgroupAttributions + idx, descr);
182 &signatureConversion)))
187 for (
const auto [idx, argTy] :
191 argAttrs ? cast<DictionaryAttr>(argAttrs[idx]) :
NamedAttrList();
192 auto copyAttribute = [&](StringRef attrName) {
196 for (
size_t i = 0, e = remapping->size; i < e; ++i)
197 llvmFuncOp.setArgAttr(remapping->inputNo + i, attrName, attr);
199 auto copyPointerAttribute = [&](StringRef attrName) {
204 if (remapping->size > 1 &&
205 attrName == LLVM::LLVMDialect::getNoAliasAttrName()) {
207 "Cannot copy noalias with non-bare pointers.\n");
210 for (
size_t i = 0, e = remapping->size; i < e; ++i) {
211 if (isa<LLVM::LLVMPointerType>(
212 llvmFuncOp.getArgument(remapping->inputNo + i).getType())) {
213 llvmFuncOp.setArgAttr(remapping->inputNo + i, attrName, attr);
221 copyAttribute(LLVM::LLVMDialect::getReturnedAttrName());
222 copyAttribute(LLVM::LLVMDialect::getNoUndefAttrName());
223 copyAttribute(LLVM::LLVMDialect::getInRegAttrName());
224 bool lowersToPointer =
false;
225 for (
size_t i = 0, e = remapping->size; i < e; ++i) {
226 lowersToPointer |= isa<LLVM::LLVMPointerType>(
227 llvmFuncOp.getArgument(remapping->inputNo + i).getType());
230 if (lowersToPointer) {
231 copyPointerAttribute(LLVM::LLVMDialect::getNoAliasAttrName());
232 copyPointerAttribute(LLVM::LLVMDialect::getNoCaptureAttrName());
233 copyPointerAttribute(LLVM::LLVMDialect::getNoFreeAttrName());
234 copyPointerAttribute(LLVM::LLVMDialect::getAlignAttrName());
235 copyPointerAttribute(LLVM::LLVMDialect::getReadonlyAttrName());
236 copyPointerAttribute(LLVM::LLVMDialect::getWriteOnlyAttrName());
237 copyPointerAttribute(LLVM::LLVMDialect::getReadnoneAttrName());
238 copyPointerAttribute(LLVM::LLVMDialect::getNonNullAttrName());
239 copyPointerAttribute(LLVM::LLVMDialect::getDereferenceableAttrName());
240 copyPointerAttribute(
241 LLVM::LLVMDialect::getDereferenceableOrNullAttrName());
249 const char formatStringPrefix[] =
"printfFormat_";
251 unsigned stringNumber = 0;
254 stringConstName.clear();
255 (formatStringPrefix + Twine(stringNumber++)).toStringRef(stringConstName);
256 }
while (moduleOp.lookupSymbol(stringConstName));
257 return stringConstName;
260 template <
typename T>
264 LLVM::LLVMFunctionType type) {
265 LLVM::LLVMFuncOp ret;
266 if (!(ret = moduleOp.template lookupSymbol<LLVM::LLVMFuncOp>(name))) {
267 ConversionPatternRewriter::InsertionGuard guard(rewriter);
269 ret = rewriter.
create<LLVM::LLVMFuncOp>(loc, name, type,
270 LLVM::Linkage::External);
276 gpu::PrintfOp gpuPrintfOp, gpu::PrintfOpAdaptor adaptor,
278 Location loc = gpuPrintfOp->getLoc();
287 auto moduleOp = gpuPrintfOp->getParentOfType<gpu::GPUModuleOp>();
292 LLVM::LLVMFuncOp ocklAppendArgs;
293 if (!adaptor.getArgs().empty()) {
295 moduleOp, loc, rewriter,
"__ockl_printf_append_args",
297 llvmI64, {llvmI64, llvmI32, llvmI64, llvmI64, llvmI64,
298 llvmI64, llvmI64, llvmI64, llvmI64, llvmI32}));
301 moduleOp, loc, rewriter,
"__ockl_printf_append_string_n",
304 {llvmI64, ptrType, llvmI64, llvmI32}));
307 Value zeroI64 = rewriter.
create<LLVM::ConstantOp>(loc, llvmI64, 0);
308 auto printfBeginCall = rewriter.
create<LLVM::CallOp>(loc, ocklBegin, zeroI64);
309 Value printfDesc = printfBeginCall.getResult();
315 formatString.push_back(
'\0');
316 size_t formatStringSize = formatString.size_in_bytes();
319 LLVM::GlobalOp global;
323 global = rewriter.
create<LLVM::GlobalOp>(
325 true, LLVM::Linkage::Internal, stringConstName,
330 Value globalPtr = rewriter.
create<LLVM::AddressOfOp>(
333 global.getSymNameAttr());
337 rewriter.
create<LLVM::ConstantOp>(loc, llvmI64, formatStringSize);
339 Value oneI32 = rewriter.
create<LLVM::ConstantOp>(loc, llvmI32, 1);
340 Value zeroI32 = rewriter.
create<LLVM::ConstantOp>(loc, llvmI32, 0);
342 auto appendFormatCall = rewriter.
create<LLVM::CallOp>(
343 loc, ocklAppendStringN,
344 ValueRange{printfDesc, stringStart, stringLen,
345 adaptor.getArgs().empty() ? oneI32 : zeroI32});
346 printfDesc = appendFormatCall.
getResult();
349 constexpr
size_t argsPerAppend = 7;
350 size_t nArgs = adaptor.getArgs().size();
351 for (
size_t group = 0; group < nArgs; group += argsPerAppend) {
352 size_t bound =
std::min(group + argsPerAppend, nArgs);
353 size_t numArgsThisCall = bound - group;
356 arguments.push_back(printfDesc);
358 rewriter.
create<LLVM::ConstantOp>(loc, llvmI32, numArgsThisCall));
359 for (
size_t i = group; i < bound; ++i) {
360 Value arg = adaptor.getArgs()[i];
361 if (
auto floatType = dyn_cast<FloatType>(arg.
getType())) {
362 if (!floatType.isF64())
363 arg = rewriter.
create<LLVM::FPExtOp>(
365 arg = rewriter.
create<LLVM::BitcastOp>(loc, llvmI64, arg);
368 arg = rewriter.
create<LLVM::ZExtOp>(loc, llvmI64, arg);
370 arguments.push_back(arg);
373 for (
size_t extra = numArgsThisCall; extra < argsPerAppend; ++extra) {
374 arguments.push_back(zeroI64);
377 auto isLast = (bound == nArgs) ? oneI32 : zeroI32;
378 arguments.push_back(isLast);
379 auto call = rewriter.
create<LLVM::CallOp>(loc, ocklAppendArgs, arguments);
387 gpu::PrintfOp gpuPrintfOp, gpu::PrintfOpAdaptor adaptor,
389 Location loc = gpuPrintfOp->getLoc();
398 auto moduleOp = gpuPrintfOp->getParentOfType<gpu::GPUModuleOp>();
403 LLVM::LLVMFuncOp printfDecl =
410 formatString.push_back(
'\0');
413 LLVM::GlobalOp global;
417 global = rewriter.
create<LLVM::GlobalOp>(
419 true, LLVM::Linkage::Internal, stringConstName,
424 Value globalPtr = rewriter.
create<LLVM::AddressOfOp>(
427 global.getSymNameAttr());
432 auto argsRange = adaptor.getArgs();
434 printfArgs.reserve(argsRange.size() + 1);
435 printfArgs.push_back(stringStart);
436 printfArgs.append(argsRange.begin(), argsRange.end());
438 rewriter.
create<LLVM::CallOp>(loc, printfDecl, printfArgs);
444 gpu::PrintfOp gpuPrintfOp, gpu::PrintfOpAdaptor adaptor,
446 Location loc = gpuPrintfOp->getLoc();
454 auto moduleOp = gpuPrintfOp->getParentOfType<gpu::GPUModuleOp>();
458 LLVM::LLVMFuncOp vprintfDecl =
465 formatString.push_back(
'\0');
468 LLVM::GlobalOp global;
472 global = rewriter.
create<LLVM::GlobalOp>(
474 true, LLVM::Linkage::Internal, stringConstName,
479 Value globalPtr = rewriter.
create<LLVM::AddressOfOp>(loc, global);
485 for (
Value arg : adaptor.getArgs()) {
486 Type type = arg.getType();
487 Value promotedArg = arg;
489 if (isa<FloatType>(type)) {
491 promotedArg = rewriter.
create<LLVM::FPExtOp>(loc, type, arg);
493 types.push_back(type);
494 args.push_back(promotedArg);
501 rewriter.
create<LLVM::AllocaOp>(loc, ptrType, structType, one,
505 loc, ptrType, structType, tempAlloc,
507 rewriter.
create<LLVM::StoreOp>(loc, arg, ptr);
509 std::array<Value, 2> printfArgs = {stringStart, tempAlloc};
511 rewriter.
create<LLVM::CallOp>(loc, vprintfDecl, printfArgs);
521 if (llvm::none_of(operandTypes, llvm::IsaPred<VectorType>)) {
533 Value result = rewriter.
create<LLVM::UndefOp>(loc, vectorType);
536 Type elementType = vectorType.getElementType();
538 for (int64_t i = 0; i < vectorType.getNumElements(); ++i) {
539 Value index = rewriter.
create<LLVM::ConstantOp>(loc, indexType, i);
540 auto extractElement = [&](
Value operand) ->
Value {
541 if (!isa<VectorType>(operand.getType()))
543 return rewriter.
create<LLVM::ExtractElementOp>(loc, operand, index);
545 auto scalarOperands = llvm::map_to_vector(operands, extractElement);
547 rewriter.
create(loc, name, scalarOperands, elementType, op->
getAttrs());
548 result = rewriter.
create<LLVM::InsertElementOp>(
549 loc, result, scalarOp->
getResult(0), index);
564 Operation *moduleOp, gpu::DynamicSharedMemoryOp op,
566 MemRefType memrefType,
unsigned alignmentBit) {
567 uint64_t alignmentByte = alignmentBit / memrefType.getElementTypeBitWidth();
569 FailureOr<unsigned> addressSpace =
571 if (failed(addressSpace)) {
572 op->
emitError() <<
"conversion of memref memory space "
573 << memrefType.getMemorySpace()
574 <<
" to integer address space "
575 "failed. Consider adding memory space conversions.";
583 existingGlobalNames.insert(globalOp.getSymName());
584 if (
auto arrayType = dyn_cast<LLVM::LLVMArrayType>(globalOp.getType())) {
585 if (globalOp.getAddrSpace() == addressSpace.value() &&
586 arrayType.getNumElements() == 0 &&
587 globalOp.getAlignment().value_or(0) == alignmentByte) {
594 unsigned uniquingCounter = 0;
597 [&](StringRef candidate) {
598 return existingGlobalNames.contains(candidate);
607 typeConverter->
convertType(memrefType.getElementType()), 0);
609 return rewriter.
create<LLVM::GlobalOp>(
610 op->
getLoc(), zeroSizedArrayType,
false,
611 LLVM::Linkage::Internal, symName,
Attribute(), alignmentByte,
612 addressSpace.value());
616 gpu::DynamicSharedMemoryOp op, OpAdaptor adaptor,
619 MemRefType memrefType = op.getResultMemref().getType();
623 MemRefLayoutAttrInterface layout = {};
625 MemRefType::get({0}, elementType, layout, memrefType.getMemorySpace());
630 LLVM::GlobalOp shmemOp = {};
638 auto basePtr = rewriter.
create<LLVM::AddressOfOp>(loc, shmemOp);
639 Type baseType = basePtr->getResultTypes().front();
643 Value shmemPtr = rewriter.
create<LLVM::GEPOp>(loc, baseType, elementType,
651 loc, memrefType0sz, shmemPtr, shmemPtr, shape, strides, rewriter);
654 rewriter.
replaceOp(op, {memRefDescriptor});
659 gpu::ReturnOp op, OpAdaptor adaptor,
666 if (useBarePtrCallConv) {
669 for (
auto it : llvm::zip(op->
getOperands(), adaptor.getOperands())) {
670 Type oldTy = std::get<0>(it).getType();
671 Value newOperand = std::get<1>(it);
673 cast<BaseMemRefType>(oldTy))) {
676 }
else if (isa<UnrankedMemRefType>(oldTy)) {
681 updatedOperands.push_back(newOperand);
684 updatedOperands = llvm::to_vector<4>(adaptor.getOperands());
691 if (numArguments <= 1) {
705 Value packed = rewriter.
create<LLVM::UndefOp>(loc, packedType);
707 packed = rewriter.
create<LLVM::InsertValueOp>(loc, packed, operand, idx);
717 [mapping](
BaseMemRefType type, gpu::AddressSpaceAttr memorySpaceAttr) {
718 gpu::AddressSpace memorySpace = memorySpaceAttr.getValue();
719 unsigned addressSpace = mapping(memorySpace);
static LLVM::LLVMFuncOp getOrDefineFunction(T &moduleOp, const Location loc, ConversionPatternRewriter &rewriter, StringRef name, LLVM::LLVMFunctionType type)
LLVM::GlobalOp getDynamicSharedMemorySymbol(ConversionPatternRewriter &rewriter, Operation *moduleOp, gpu::DynamicSharedMemoryOp op, const LLVMTypeConverter *typeConverter, MemRefType memrefType, unsigned alignmentBit)
Generates a symbol with 0-sized array type for dynamic shared memory usage, or uses existing symbol.
static IntegerAttr wrapNumericMemorySpace(MLIRContext *ctx, unsigned space)
static SmallString< 16 > getUniqueFormatGlobalName(gpu::GPUModuleOp moduleOp)
static std::string diag(const llvm::Value &value)
static Value min(ImplicitLocOpBuilder &builder, Value value, Value bound)
Attributes are known-constant values of operations.
This class provides a shared interface for ranked and unranked memref types.
iterator_range< op_iterator< OpT > > getOps()
Return an iterator range over the operations within this block that are of 'OpT'.
IntegerAttr getIndexAttr(int64_t value)
IntegerType getIntegerType(unsigned width)
StringAttr getStringAttr(const Twine &bytes)
MLIRContext * getContext() const
This class implements a pattern rewriter for use with ConversionPatterns.
void replaceOp(Operation *op, ValueRange newValues) override
PatternRewriter hook for replacing an operation.
FailureOr< Block * > convertRegionTypes(Region *region, const TypeConverter &converter, TypeConverter::SignatureConversion *entryConversion=nullptr)
Apply a signature conversion to each block in the given region.
void eraseOp(Operation *op) override
PatternRewriter hook for erasing a dead operation.
const TypeConverter * typeConverter
An optional type converter for use by this pattern.
MemRefDescriptor createMemRefDescriptor(Location loc, MemRefType memRefType, Value allocatedPtr, Value alignedPtr, ArrayRef< Value > sizes, ArrayRef< Value > strides, ConversionPatternRewriter &rewriter) const
Creates and populates a canonical memref descriptor struct.
void getMemRefDescriptorSizes(Location loc, MemRefType memRefType, ValueRange dynamicSizes, ConversionPatternRewriter &rewriter, SmallVectorImpl< Value > &sizes, SmallVectorImpl< Value > &strides, Value &size, bool sizeInBytes=true) const
Computes sizes, strides and buffer size of memRefType with identity layout.
const LLVMTypeConverter * getTypeConverter() const
LogicalResult copyUnrankedDescriptors(OpBuilder &builder, Location loc, TypeRange origTypes, SmallVectorImpl< Value > &operands, bool toDynamic) const
Copies the memory descriptor for any operands that were unranked descriptors originally to heap-alloc...
This class contains all of the information necessary to report a diagnostic to the DiagnosticEngine.
Conversion from types to the LLVM IR dialect.
Type packFunctionResults(TypeRange types, bool useBarePointerCallConv=false) const
Convert a non-empty list of types to be returned from a function into an LLVM-compatible type.
const LowerToLLVMOptions & getOptions() const
Type convertFunctionSignature(FunctionType funcTy, bool isVariadic, bool useBarePtrCallConv, SignatureConversion &result) const
Convert a function type.
LogicalResult convertType(Type t, SmallVectorImpl< Type > &results) const
Convert the given type.
FailureOr< unsigned > getMemRefAddressSpace(BaseMemRefType type) const
Return the LLVM address space corresponding to the memory space of the memref type type or failure if...
static LLVMStructType getLiteral(MLIRContext *context, ArrayRef< Type > types, bool isPacked=false)
Gets or creates a literal struct with the given body in the provided context.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
MLIRContext is the top-level object for a collection of MLIR operations.
Helper class to produce LLVM dialect operations extracting or inserting elements of a MemRef descript...
Value allocatedPtr(OpBuilder &builder, Location loc)
Builds IR extracting the allocated pointer from the descriptor.
static MemRefDescriptor fromStaticShape(OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, MemRefType type, Value memory)
Builds IR creating a MemRef descriptor that represents type and populates it with static shape and st...
NamedAttrList is array of NamedAttributes that tracks whether it is sorted and does some basic work t...
Attribute erase(StringAttr name)
Erase the attribute with the given name from the list.
RAII guard to reset the insertion point of the builder when destroyed.
void setInsertionPointToStart(Block *block)
Sets the insertion point to the start of the specified block.
void setInsertionPoint(Block *block, Block::iterator insertPoint)
Set the insertion point to the specified location.
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
A trait used to provide symbol table functionalities to a region operation.
type_range getTypes() const
StringAttr getIdentifier() const
Return the name of this operation as a StringAttr.
Operation is the basic unit of execution within MLIR.
unsigned getNumSuccessors()
OpResult getResult(unsigned idx)
Get the 'idx'th result of this operation.
unsigned getNumRegions()
Returns the number of regions held by this operation.
Location getLoc()
The source location the operation was defined or derived from.
unsigned getNumOperands()
ArrayRef< NamedAttribute > getAttrs()
Return all of the attributes on this operation.
InFlightDiagnostic emitError(const Twine &message={})
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers tha...
OpTy getParentOfType()
Return the closest surrounding parent operation that is of type 'OpTy'.
Region & getRegion(unsigned index)
Returns the region held by this operation at position 'index'.
Operation * getParentWithTrait()
Returns the closest surrounding parent operation with trait Trait.
OperationName getName()
The name of an operation is the key identifier for it.
operand_type_range getOperandTypes()
operand_range getOperands()
Returns an iterator on the underlying Value's.
unsigned getNumResults()
Return the number of results held by this operation.
std::enable_if_t<!std::is_convertible< CallbackT, Twine >::value, LogicalResult > notifyMatchFailure(Location loc, CallbackT &&reasonCallback)
Used to notify the listener that the IR failed to be rewritten because of a match failure,...
void inlineRegionBefore(Region ®ion, Region &parent, Region::iterator before)
Move the blocks that belong to "region" before the given position in another region "parent".
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
static StringRef getSymbolAttrName()
Return the name of the attribute used for symbol names.
This class provides all of the information necessary to convert a type signature.
std::optional< InputMapping > getInputMapping(unsigned input) const
Get the input mapping for the given argument.
void remapInput(unsigned origInputNo, Value replacement)
Remap an input of the original signature to another replacement value.
LogicalResult convertType(Type t, SmallVectorImpl< Type > &results) const
Convert the given type.
void addTypeAttributeConversion(FnT &&callback)
Register a conversion function for attributes within types.
This class provides an abstraction over the various different ranges of value types.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
bool isIntOrFloat() const
Return true if this is an integer (of any signedness) or a float type.
unsigned getIntOrFloatBitWidth() const
Return the bit width of an integer or a float type, assert failure on other types.
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Type getType() const
Return the type of this value.
constexpr void enumerate(std::tuple< Tys... > &tuple, CallbackT &&callback)
LogicalResult scalarizeVectorOp(Operation *op, ValueRange operands, ConversionPatternRewriter &rewriter, const LLVMTypeConverter &converter)
Unrolls op if it's operating on vectors.
Include the generated interface declarations.
InFlightDiagnostic emitWarning(Location loc)
Utility method to emit a warning message using this location.
std::function< unsigned(gpu::AddressSpace)> MemorySpaceMapping
A function that maps a MemorySpace enum to a target-specific integer value.
void populateGpuMemorySpaceAttributeConversions(TypeConverter &typeConverter, const MemorySpaceMapping &mapping)
Populates memory space attribute conversion rules for lowering gpu.address_space to integer values.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
LogicalResult matchAndRewrite(gpu::DynamicSharedMemoryOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override
LogicalResult matchAndRewrite(gpu::GPUFuncOp gpuFuncOp, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override
LogicalResult matchAndRewrite(gpu::PrintfOp gpuPrintfOp, gpu::PrintfOpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override
LogicalResult matchAndRewrite(gpu::PrintfOp gpuPrintfOp, gpu::PrintfOpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override
LogicalResult matchAndRewrite(gpu::PrintfOp gpuPrintfOp, gpu::PrintfOpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override
LogicalResult matchAndRewrite(gpu::ReturnOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override