31  auto memRefType = cast<MemRefType>(from.
getType());
 
   32  auto rank = memRefType.getRank();
 
   40  if (rank < GPUDialect::getNumWorkgroupDimensions()) {
 
   41    unsigned extraLoops = GPUDialect::getNumWorkgroupDimensions() - rank;
 
   42    lbs.resize(extraLoops, zero);
 
   43    ubs.resize(extraLoops, one);
 
   44    steps.resize(extraLoops, one);
 
   48  lbs.append(rank, zero);
 
   49  ubs.reserve(lbs.size());
 
   50  steps.reserve(lbs.size());
 
   51  for (
auto idx = 0; idx < rank; ++idx) {
 
   52    ubs.push_back(
b.createOrFold<memref::DimOp>(from, idx));
 
   57  auto indexType = 
b.getIndexType();
 
   59  for (
auto dim : {gpu::Dimension::x, gpu::Dimension::y, gpu::Dimension::z}) {
 
   60    threadIds.push_back(gpu::ThreadIdOp::create(
b, indexType, dim));
 
   61    blockDims.push_back(gpu::BlockDimOp::create(
b, indexType, dim));
 
   67      b, 
b.getLoc(), lbs, ubs, steps,
 
   69        ivs.assign(loopIvs.begin(), loopIvs.end());
 
   70        auto activeIvs = llvm::ArrayRef(ivs).take_back(rank);
 
   71        Value loaded = memref::LoadOp::create(b, loc, from, activeIvs);
 
   72        memref::StoreOp::create(b, loc, loaded, to, activeIvs);
 
   78           GPUDialect::getNumWorkgroupDimensions())))) {
 
   81    affine::mapLoopToProcessorIds(loop, {threadIds[en.index()]},
 
   82                                  {blockDims[en.index()]});
 
 
  121  auto fromType = cast<MemRefType>(from.
getType());
 
  122  auto toType = cast<MemRefType>(to.
getType());
 
  125  assert(fromType.getShape() == toType.getShape());
 
  126  assert(fromType.getRank() != 0);
 
  127  assert(region.
hasOneBlock() && 
"unstructured control flow not supported");
 
  131  gpu::BarrierOp::create(
b);
 
  134  gpu::BarrierOp::create(
b);
 
 
  141  Value value = op.getArgument(arg);
 
  142  auto type = dyn_cast<MemRefType>(value.
getType());
 
  143  assert(type && type.hasStaticShape() && 
"can only promote memrefs");
 
  146  auto workgroupMemoryAddressSpace = gpu::AddressSpaceAttr::get(
 
  147      op->getContext(), gpu::AddressSpace::Workgroup);
 
  148  auto bufferType = MemRefType::get(type.getShape(), type.getElementType(),
 
  149                                    MemRefLayoutAttrInterface{},
 
  151  Value attribution = op.addWorkgroupAttribution(bufferType, value.
getLoc());
 
  156  insertCopies(op.getBody(), op.getLoc(), value, attribution);
 
Attributes are known-constant values of operations.
 
ImplicitLocOpBuilder maintains a 'current location', allowing use of the create<> method without spec...
 
static ImplicitLocOpBuilder atBlockBegin(Location loc, Block *block, Listener *listener=nullptr)
Create a builder and set the insertion point to before the first operation in the block but still ins...
 
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
 
This class helps build Operations.
 
This class contains a list of basic blocks and a link to the parent operation it is attached to.
 
Operation * getParentOp()
Return the parent operation this region is attached to.
 
bool hasOneBlock()
Return true if this region has exactly one block.
 
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.
 
void replaceAllUsesWith(Value newValue)
Replace all uses of 'this' value with the new value, updating anything in the IR that uses 'this' to ...
 
Location getLoc() const
Return the location of this value.
 
Region * getParentRegion()
Return the Region in which this Value is defined.
 
static ConstantIndexOp create(OpBuilder &builder, Location location, int64_t value)
 
LoopNest buildLoopNest(OpBuilder &builder, Location loc, ValueRange lbs, ValueRange ubs, ValueRange steps, ValueRange iterArgs, function_ref< ValueVector(OpBuilder &, Location, ValueRange, ValueRange)> bodyBuilder=nullptr)
Creates a perfect nest of "for" loops, i.e.
 
Include the generated interface declarations.
 
void promoteToWorkgroupMemory(gpu::GPUFuncOp op, unsigned arg)
Promotes a function argument to workgroup memory in the given function.