14#include "mlir/Dialect/Arith/IR/Arith.h"
15#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
16#include "mlir/Dialect/Utils/StaticValueUtils.h"
17#include "mlir/IR/Iterators.h"
18#include "llvm/Support/MathExtras.h"
55 Value gt =
builder.createOrFold<arith::CmpIOp>(
loc, arith::CmpIPredicate::ugt,
57 return builder.createOrFold<arith::SelectOp>(
loc, gt, t, e);
61 Value gt =
builder.createOrFold<arith::CmpIOp>(
loc, arith::CmpIPredicate::ugt,
63 return builder.createOrFold<arith::SelectOp>(
loc, gt, t, e);
68 builder.createOrFold<arith::CmpIOp>(
loc, arith::CmpIPredicate::ult, a, b);
69 return builder.createOrFold<arith::SelectOp>(
loc, lt, t, e);
77 const Twine &message) {
78 if (
auto c = getConstantIntValue(cond)) {
81 return emitError(loc) << message;
83 cf::AssertOp::create(builder, loc, cond, builder.getStringAttr(message));
88 root->walk<WalkOrder::PostOrder, ReverseIterator>([](Operation *op) {
89 if (isa<arith::ArithDialect>(op->getDialect()) && isOpTriviallyDead(op))
105 Value cst(uint64_t c) {
106 return arith::ConstantOp::create(b, loc, b.getI64IntegerAttr((int64_t)c));
108 Value add(Value x, Value y) {
109 return b.createOrFold<arith::AddIOp>(loc, x, y);
111 Value sub(Value x, uint64_t c) {
112 return b.createOrFold<arith::SubIOp>(loc, x, cst(c));
114 Value mul(Value x, Value y) {
115 return b.createOrFold<arith::MulIOp>(loc, x, y);
117 Value both(Value x, Value y) {
118 return b.createOrFold<arith::AndIOp>(loc, x, y);
120 Value either(Value x, Value y) {
121 return b.createOrFold<arith::OrIOp>(loc, x, y);
123 Value cmp(arith::CmpIPredicate pred, Value x, Value y) {
124 return b.createOrFold<arith::CmpIOp>(loc, pred, x, y);
126 Value eq(Value x, Value y) {
return cmp(arith::CmpIPredicate::eq, x, y); }
127 Value eq(Value x, uint64_t c) {
return eq(x, cst(c)); }
128 Value ule(Value x, uint64_t c) {
129 return cmp(arith::CmpIPredicate::ule, x, cst(c));
132 Value inRange1(Value x, uint64_t hi) {
return ule(sub(x, 1), hi - 1); }
133 Value multipleOf(Value x, uint64_t d) {
134 return eq(b.createOrFold<arith::RemUIOp>(loc, x, cst(d)), 0);
136 LogicalResult check(Value cond,
const Twine &message) {
143Value
getAsI64(OpBuilder &builder, Location loc, OpFoldResult ofr) {
144 Type i64 = builder.getI64Type();
145 if (
auto c = getConstantIntValue(ofr))
147 arith::ConstantOp::create(builder, loc, IntegerAttr::get(i64, *c)));
148 Value v = cast<Value>(ofr);
149 if (v.getType().isIndex())
150 return Value(arith::IndexCastUIOp::create(builder, loc, i64, v));
151 unsigned bits = v.getType().getIntOrFloatBitWidth();
153 return Value(arith::ExtUIOp::create(builder, loc, i64, v));
155 GuardBuilder g{builder, loc};
156 Value max = arith::ConstantOp::create(
158 IntegerAttr::get(v.getType(), APInt::getMaxValue(64).zext(bits)));
159 if (failed(g.check(g.cmp(arith::CmpIPredicate::ule, v, max),
160 "a runtime DMA operand does not fit in 64 bits")))
162 return Value(arith::TruncIOp::create(builder, loc, i64, v));
171Value
getAsValue(OpBuilder &builder, Location loc, OpFoldResult ofr,
173 if (
auto constVal = getConstantIntValue(ofr))
174 return arith::ConstantOp::create(builder, loc,
175 IntegerAttr::get(intType, *constVal));
176 Value val = cast<Value>(ofr);
177 if (val.getType() != intType) {
178 if (val.getType().isIndex())
179 return arith::IndexCastUIOp::create(builder, loc, intType, val);
180 unsigned valBits = val.getType().getIntOrFloatBitWidth();
181 unsigned tgtBits = intType.getIntOrFloatBitWidth();
182 if (valBits > tgtBits)
183 val = arith::TruncIOp::create(builder, loc, intType, val);
185 val = arith::ExtUIOp::create(builder, loc, intType, val);
191 ArrayRef<OpFoldResult> elementOffsets,
192 ArrayRef<OpFoldResult> strides, int64_t elemWidthBytes,
193 int64_t baseByteOffset, uint32_t granuleBytes) {
194 auto i32ty = builder.getIntegerType(32);
198 bool allConst = llvm::all_of(elementOffsets,
200 return getConstantIntValue(o).has_value();
202 llvm::all_of(strides, [](OpFoldResult s) {
203 return getConstantIntValue(s).has_value();
206 int64_t bytes = baseByteOffset;
207 for (
auto [o, s] : llvm::zip(elementOffsets, strides)) {
208 auto oc = getConstantIntValue(o);
209 auto sc = getConstantIntValue(s);
210 assert(oc && sc &&
"allConst already verified these are constant");
211 bytes += (*oc) * (*sc) * elemWidthBytes;
213 if (bytes > std::numeric_limits<uint32_t>::max() || bytes < 0)
214 return Value(arith::ConstantOp::create(
215 builder, loc, IntegerAttr::get(builder.getIntegerType(64), bytes)));
216 return Value(arith::ConstantOp::create(builder, loc,
217 IntegerAttr::get(i32ty, bytes)));
223 GuardBuilder g{builder, loc};
224 Value acc = g.cst(0);
227 uint64_t knownMultiple = (uint64_t)baseByteOffset;
228 for (
auto [o, s] : llvm::zip(elementOffsets, strides)) {
229 Value ov =
getAsI64(builder, loc, o);
230 Value sv =
getAsI64(builder, loc, s);
233 acc = g.add(acc, g.mul(ov, sv));
234 uint64_t factor = (uint64_t)elemWidthBytes;
235 for (OpFoldResult f : {o, s})
236 if (
auto c = getConstantIntValue(f))
237 factor *= (uint64_t)*c;
238 knownMultiple = std::gcd(knownMultiple, factor);
240 acc = g.mul(acc, g.cst(elemWidthBytes));
241 if (baseByteOffset != 0)
242 acc = g.add(acc, g.cst(baseByteOffset));
243 if (granuleBytes > 1 && knownMultiple % granuleBytes != 0 &&
244 failed(g.check(g.eq(builder.createOrFold<arith::AndIOp>(
245 loc, acc, g.cst(granuleBytes - 1)),
247 "a runtime DMA offset is not " + Twine(granuleBytes) +
254 OpBuilder &builder, Location loc, BaseMemRefType hostBufferType,
255 int64_t baseByteOffset, int64_t elemWidthBytes,
256 ArrayRef<OpFoldResult> offsets, ArrayRef<OpFoldResult> offsetStrides,
257 ArrayRef<OpFoldResult> sizes, ArrayRef<OpFoldResult> strides) {
260 constexpr uint64_t kMaxElems = 1ULL << 32;
261 uint64_t cap = kMaxElems;
262 if (hostBufferType.hasStaticShape()) {
263 int64_t bytes = hostBufferType.getNumElements() *
264 (int64_t)hostBufferType.getElementTypeBitWidth() / 8;
265 cap = bytes > baseByteOffset
266 ? std::min<uint64_t>((bytes - baseByteOffset) / elemWidthBytes,
271 return emitError(loc) <<
"DMA transfer starts past the end of its host "
278 GuardBuilder g{builder, loc};
279 Value ok, sum = g.cst(0);
280 auto addTerm = [&](Value c, Value t) {
281 Value cZero = g.eq(c, 0);
282 Value tFits = g.either(cZero, g.ule(t, cap - 1));
283 Value tZero = g.eq(t, 0);
284 Value inRange = g.both(tFits, g.either(tZero, g.ule(c, cap - 1)));
285 ok = ok ? g.both(ok, inRange) : inRange;
286 sum = g.add(sum, g.mul(c, t));
288 for (
auto [o, s] : llvm::zip(offsets, offsetStrides)) {
289 Value ov =
getAsI64(builder, loc, o);
290 Value sv =
getAsI64(builder, loc, s);
295 for (
auto [sz, st] : llvm::zip(sizes, strides)) {
296 Value szv =
getAsI64(builder, loc, sz);
297 Value stv =
getAsI64(builder, loc, st);
300 addTerm(g.sub(szv, 1), stv);
302 Value cond = ok ? g.both(ok, g.ule(sum, cap - 1)) : g.ule(sum, cap - 1);
303 return g.check(cond,
"a runtime DMA access runs past the end of its " +
304 Twine(cap) +
"-element host buffer");
308 ArrayRef<std::tuple<Value, uint32_t, uint32_t>> fields) {
309 auto i32ty = builder.getIntegerType(32);
311 arith::ConstantOp::create(builder, loc, IntegerAttr::get(i32ty, 0));
312 for (
auto &[val, mask, shift] : fields) {
314 if (mask != 0xFFFFFFFF) {
315 auto maskConst = arith::ConstantOp::create(
316 builder, loc, IntegerAttr::get(i32ty, (int64_t)(int32_t)mask));
317 masked = builder.createOrFold<arith::AndIOp>(loc, masked, maskConst);
320 auto shiftConst = arith::ConstantOp::create(
321 builder, loc, IntegerAttr::get(i32ty, shift));
322 masked = builder.createOrFold<arith::ShLIOp>(loc, masked, shiftConst);
324 result = builder.createOrFold<arith::OrIOp>(loc, result, masked);
331 int tileRow, OpFoldResult bdId,
int channel,
332 AIE::DMAChannelDir direction) {
333 auto i32ty = builder.getIntegerType(32);
334 if (
auto c = getConstantIntValue(bdId))
337 static_cast<uint32_t
>(
344 uint32_t first = channel < 0 ? 0
349 uint64_t addrForFirst =
350 targetModel.
getDmaBdAddress(tileCol, tileRow, first, channel, direction);
351 uint64_t bdStride = targetModel.
getDmaBdAddress(tileCol, tileRow, first + 1,
352 channel, direction) -
354 uint64_t addrForId0 = addrForFirst - first * bdStride;
355 Value bdIdVal =
getAsValue(builder, loc, bdId, i32ty);
356 return arith::AddIOp::create(
358 arith::MulIOp::create(builder, loc, bdIdVal,
364 int tileCol,
int tileRow,
365 AIE::DMAChannelDir direction) {
367 return op->emitOpError(
"cannot write a buffer descriptor for a ")
368 << AIE::stringifyDMAChannelDir(direction)
369 <<
" channel from the runtime sequence yet";
375 int tileCol,
int tileRow,
376 uint32_t packetType) {
380 return op->emitOpError(
"the buffer descriptors of tile (")
381 << tileCol <<
", " << tileRow
382 <<
") have no packet type field: it is a DMA channel setting";
390 Value hwS[4], hwT[4];
394 bool isLinear =
false;
397LogicalResult encodeBdCommon(OpBuilder &builder, Location loc,
398 const AIE::AIETargetModel &tm,
399 const AIE::DmaBdLayout &layout,
int tileCol,
400 int tileRow, ArrayRef<OpFoldResult> mixedSizes,
401 ArrayRef<OpFoldResult> mixedStrides,
402 uint64_t elemWidth, OpFoldResult lenElems,
404 auto i32ty = builder.getIntegerType(32);
405 uint32_t gran = tm.getAddressGenGranularity();
406 SmallVector<OpFoldResult, 4> sizesRev(llvm::reverse(mixedSizes));
407 SmallVector<OpFoldResult, 4> stridesRev(llvm::reverse(mixedStrides));
408 auto cst = [&](OpFoldResult v) {
return getConstantIntValue(v); };
409 auto constEq = [&](OpFoldResult v, int64_t c) {
416 auto knownLinear = [&]() {
417 return constEq(sizesRev[1], 1) && constEq(sizesRev[2], 1) &&
418 constEq(stridesRev[0], 1) && constEq(stridesRev[1], 0) &&
419 constEq(stridesRev[2], 0);
424 auto knownContiguous = [&]() ->
bool {
425 auto s0 = cst(stridesRev[0]);
428 auto sz0 = cst(sizesRev[0]);
429 auto d1sz = cst(sizesRev[1]);
430 auto d1st = cst(stridesRev[1]);
431 if (!d1sz || *d1sz != 1)
432 if (!sz0 || !d1st || *d1st != *sz0)
434 auto d2sz = cst(sizesRev[2]);
435 auto d2st = cst(stridesRev[2]);
436 if (!d2sz || *d2sz != 1) {
438 (sz0 && d1sz) ? std::optional<int64_t>(*sz0 * *d1sz) : std::nullopt;
439 if (!prod01 || !d2st || *d2st != *prod01)
448 out.isLinear = knownLinear() ||
449 (tm.isShimNOCTile(tileCol, tileRow) && knownContiguous());
450 bool isLinear = out.isLinear;
452 Value inS[4], inT[4];
453 for (
int i = 0; i < 4; i++) {
454 inS[i] =
getAsI64(builder, loc, sizesRev[i]);
455 inT[i] =
getAsI64(builder, loc, stridesRev[i]);
456 if (!inS[i] || !inT[i])
463 uint64_t ew = elemWidth;
464 uint64_t wrapMax = (1ULL << tm.getDmaBdWrapBits(tileCol, tileRow)) - 1;
465 uint64_t maxLen = tm.getDmaBdMaxLen(tileCol, tileRow);
467 ((1ULL << tm.getDmaBdStepBits(tileCol, tileRow)) - 1 + layout.stepBias) *
469 uint64_t maxIterations = 1ULL << tm.getDmaBdIterBits(tileCol, tileRow);
470 uint64_t maxRepeats = tm.getMaxRepeatCount() + 1;
471 GuardBuilder g{builder, loc};
473 auto checkSize = [&](
int i, uint64_t hi) {
474 sizeMax[i] = getConstantIntValue(sizesRev[i]).value_or(hi);
475 return g.check(g.inRange1(inS[i], hi),
476 (i == 3 ? Twine(
"a runtime DMA repeat count")
477 :
"a runtime DMA d" + Twine(i) +
" size") +
478 " must be in [1:" + Twine(hi) +
"]");
480 if (failed(checkSize(0, (isLinear ? maxLen : wrapMax) * gran / ew)) ||
481 failed(checkSize(1, isLinear ? maxLen : wrapMax)) ||
482 failed(checkSize(2, maxLen)) || failed(checkSize(3, maxRepeats)))
484 Value pureRepeat = g.eq(inT[3], 0);
486 g.either(pureRepeat, g.ule(g.sub(inS[3], 1), maxIterations - 1)),
487 "a runtime DMA iteration count must be in [1:" +
488 Twine(maxIterations) +
"]")))
490 bool hasD0Stride = layout.d0Stride.exists();
491 for (
int i = 0; i < 4; i++) {
492 if (i < 3 && (isLinear || (i == 0 && (ew > gran || !hasD0Stride))))
495 i == 3 ? g.ule(inT[3], maxStride) : g.inRange1(inT[i], maxStride);
496 if (failed(g.check(g.either(g.ule(inS[i], 1), inRange),
497 (i == 3 ? Twine(
"a runtime DMA iteration stride")
498 :
"a runtime DMA d" + Twine(i) +
" stride") +
499 " must be in [" + Twine(i == 3 ? 0 : 1) +
":" +
500 Twine(maxStride) +
"] when its size > 1")))
507 Value d0Unit = g.eq(inT[0], 1);
508 if (failed(g.check(g.either(g.ule(inS[0], 1), d0Unit),
509 "a runtime DMA d0 stride must be 1: this tile's BDs "
510 "have no d0 stride")))
512 }
else if (ew != gran) {
513 Value d0Unit = g.eq(inT[0], 1);
514 if (failed(g.check(g.either(g.ule(inS[0], 1), d0Unit),
515 "a runtime DMA d0 stride must be 1 for " +
517 "-byte elements (the DMA moves whole " +
518 Twine(gran / 8) +
"-byte granules)")))
526 auto checkMultiple = [&](Value v,
const Twine &what) {
527 return g.check(g.multipleOf(v, divisor),
528 "a runtime DMA " + what +
" must be a multiple of " +
529 Twine(divisor) +
" elements (whole " +
530 Twine(gran / 8) +
"-byte granules)");
532 if (failed(checkMultiple(inS[0],
"d0 size")))
534 for (
int i = 1; i < 4; i++)
535 if (failed(checkMultiple(inT[i], i == 3 ? Twine(
"iteration stride")
536 :
"d" + Twine(i) +
" stride")))
541 Value hwS[4], hwT[4];
551 Value d0d1 = g.mul(hwS[0], inS[1]);
552 Value bufLen = g.mul(d0d1, inS[2]);
553 uint64_t lenMax = llvm::SaturatingMultiply(
554 llvm::SaturatingMultiply(sizeMax[0] * ew / gran, sizeMax[1]), sizeMax[2]);
555 if (lenMax > maxLen) {
556 Value lenFits = g.ule(bufLen, maxLen);
558 lenFits = g.both(g.ule(d0d1, maxLen), lenFits);
559 if (failed(g.check(lenFits,
"a runtime DMA transfer exceeds the " +
561 "-granule BD buffer_length")))
565 Value lenV =
getAsI64(builder, loc, lenElems);
568 if (failed(g.check(g.inRange1(lenV, maxLen * gran / ew),
569 "a runtime DMA length must be in [1:" +
570 Twine(maxLen * gran / ew) +
"] elements")) ||
572 failed(g.check(g.multipleOf(lenV, divisor),
573 "a runtime DMA length must be a multiple of " +
574 Twine(divisor) +
" elements (whole " +
575 Twine(gran / 8) +
"-byte granules)"))))
579 ? g.mul(lenV, g.cst(ew / gran))
580 : builder.createOrFold<arith::DivUIOp>(loc, lenV, g.cst(gran / ew));
581 if (failed(g.check(g.eq(lenGranules, bufLen),
582 "a runtime DMA length must equal the d0*d1*d2 extent "
583 "of its dimensions")))
587 auto asI32 = [&](Value v) {
588 return builder.createOrFold<arith::TruncIOp>(loc, i32ty, v);
590 for (
int i = 0; i < 4; i++) {
591 out.hwS[i] = asI32(hwS[i]);
592 out.hwT[i] = asI32(hwT[i]);
594 out.bufLen = asI32(bufLen);
599 out.iterSizeField = asI32(policy.selectGT0(inT[3], hwS[3], policy.cst(0)));
604 if (
auto outerConst = getConstantIntValue(sizesRev[3])) {
605 int64_t r = *outerConst > 1 ? *outerConst - 1 : 0;
607 arith::ConstantOp::create(builder, loc, IntegerAttr::get(i32ty, r));
609 out.repeatCount = out.hwS[3];
615void packBdWords(OpBuilder &builder, Location loc,
616 const AIE::AIETargetModel &tm,
const AIE::DmaBdLayout &layout,
618 uint32_t burstLength, uint32_t axcache,
619 SmallVectorImpl<Value> &wordsOut) {
620 using Field = std::tuple<Value, uint32_t, uint32_t>;
621 SmallVector<uint32_t, 8> constWords(layout.numWords, 0);
622 SmallVector<SmallVector<Field, 3>, 8> runtimeWords(layout.numWords);
623 auto set = [&](
const AIE::DmaBdField &field, uint64_t value) {
625 constWords[field.word] |= field.place(value);
627 auto add = [&](
const AIE::DmaBdField &field, Value value) {
629 runtimeWords[field.word].push_back({value, field.mask(), field.shift});
632 set(layout.enablePacket, f.enable_packet);
633 set(layout.packetType, f.packet_type);
634 set(layout.packetId, f.packet_id);
635 set(layout.outOfOrderId, f.out_of_order_id);
636 set(layout.iterationCurrent, f.iteration_current);
637 if (layout.burstLength.exists())
639 set(layout.axcache, axcache);
640 if (f.next_bd_id_val)
641 add(layout.nextBd, f.next_bd_id_val);
643 set(layout.nextBd, f.next_bd_id);
644 set(layout.useNextBd, f.use_next_bd);
645 set(layout.validBd, 1);
646 if (f.lock_rel_val_val)
647 add(layout.lockRelValue, f.lock_rel_val_val);
649 set(layout.lockRelValue, f.lock_rel_val);
650 set(layout.lockRelId, f.lock_rel_id);
651 set(layout.lockAcqEnable, f.lock_acq_enable);
652 if (f.lock_acq_val_val)
653 add(layout.lockAcqValue, f.lock_acq_val_val);
655 set(layout.lockAcqValue, f.lock_acq_val);
656 set(layout.lockAcqId, f.lock_acq_id);
658 add(layout.bufferLength, e.bufLen);
660 add(layout.d0Size, e.hwS[0]);
661 add(layout.d0Stride, e.hwT[0]);
662 add(layout.d1Size, e.hwS[1]);
663 add(layout.d1Stride, e.hwT[1]);
664 add(layout.d2Stride, e.hwT[2]);
666 add(layout.iterationSize, e.iterSizeField);
667 add(layout.iterationStride, e.hwT[3]);
670 for (
auto [constWord, fields] : llvm::zip(constWords, runtimeWords)) {
671 if (fields.empty()) {
675 auto [value, mask, shift] = fields.front();
676 if (constWord == 0 && fields.size() == 1 && mask == 0xFFFFFFFF &&
678 wordsOut.push_back(value);
683 word = builder.createOrFold<arith::OrIOp>(
685 wordsOut.push_back(word);
695 ArrayRef<OpFoldResult> mixedStrides, uint64_t elemWidth,
696 uint32_t burstLength, uint32_t axcache, OpFoldResult lenElems,
697 Value &repeatCountOut, SmallVectorImpl<Value> &wordsOut) {
700 return emitError(loc,
"no buffer descriptor layout on tile (")
701 << tileCol <<
", " << tileRow <<
")";
703 if (failed(encodeBdCommon(builder, loc, targetModel, *layout, tileCol,
704 tileRow, mixedSizes, mixedStrides, elemWidth,
707 repeatCountOut = e.repeatCount;
709 packBdWords(builder, loc, targetModel, *layout, f, e, burstLength, axcache,
std::pair< uint32_t, uint32_t > getBdIdRangeForChannel(int col, int row, int channel, DMAChannelDir dir) const
Return the half-open range of BD ids channel in dir can submit.
virtual const DmaBdLayout * getDmaBdLayout(AIETileType tileType) const
Return the register layout of a buffer descriptor on the given tile type, or null if the target has n...
virtual uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel=-1, AIE::DMAChannelDir direction=AIE::DMAChannelDir::MM2S) const =0
Return the array address of the dma buffer descriptor for the given col, row, buffer descriptor id,...
bool usesChannelLocalBdIds(int col, int row, DMAChannelDir direction) const
Control and trace channels always have private, channel-local pools.
mlir::LogicalResult verifyRuntimeBdTarget(mlir::Operation *op, const xilinx::AIE::AIETargetModel &targetModel, int tileCol, int tileRow, xilinx::AIE::DMAChannelDir direction=xilinx::AIE::DMAChannelDir::MM2S)
int64_t bdGranuleDivisor(uint64_t elemWidth, uint32_t addressGranularity)
mlir::Value buildBdWord(mlir::OpBuilder &builder, mlir::Location loc, llvm::ArrayRef< std::tuple< mlir::Value, uint32_t, uint32_t > > fields)
mlir::Value buildArgPlusValue(mlir::OpBuilder &builder, mlir::Location loc, llvm::ArrayRef< mlir::OpFoldResult > elementOffsets, llvm::ArrayRef< mlir::OpFoldResult > strides, int64_t elemWidthBytes, int64_t baseByteOffset, uint32_t granuleBytes)
mlir::Value getAsValue(mlir::OpBuilder &builder, mlir::Location loc, mlir::OpFoldResult ofr, mlir::Type intType)
mlir::Value getBdRegisterBase(mlir::OpBuilder &builder, mlir::Location loc, const xilinx::AIE::AIETargetModel &targetModel, int tileCol, int tileRow, mlir::OpFoldResult bdId, int channel=-1, xilinx::AIE::DMAChannelDir direction=xilinx::AIE::DMAChannelDir::MM2S)
void encodeHardwareStridesWraps(Policy &p, uint64_t elemWidth, uint32_t addressGranularity, int64_t stepBias, typename Policy::V inputSizes[4], typename Policy::V inputStrides[4], typename Policy::V sizes[4], typename Policy::V strides[4])
mlir::LogicalResult guardWithinHostBuffer(mlir::OpBuilder &builder, mlir::Location loc, mlir::BaseMemRefType hostBufferType, int64_t baseByteOffset, int64_t elemWidthBytes, llvm::ArrayRef< mlir::OpFoldResult > offsets, llvm::ArrayRef< mlir::OpFoldResult > offsetStrides, llvm::ArrayRef< mlir::OpFoldResult > sizes, llvm::ArrayRef< mlir::OpFoldResult > strides)
mlir::LogicalResult buildBdWords(mlir::OpBuilder &builder, mlir::Location loc, const xilinx::AIE::AIETargetModel &targetModel, int tileCol, int tileRow, const BdTemplateFields &fields, llvm::ArrayRef< mlir::OpFoldResult > mixedSizes, llvm::ArrayRef< mlir::OpFoldResult > mixedStrides, uint64_t elemWidth, uint32_t burstLength, uint32_t axcache, mlir::OpFoldResult lenElems, mlir::Value &repeatCountOut, llvm::SmallVectorImpl< mlir::Value > &wordsOut)
mlir::Value getAsI64(mlir::OpBuilder &builder, mlir::Location loc, mlir::OpFoldResult ofr)
void eraseDeadArith(mlir::Operation *root)
mlir::LogicalResult emitRuntimeCheck(mlir::OpBuilder &builder, mlir::Location loc, mlir::Value cond, const llvm::Twine &message)
mlir::LogicalResult verifyBdPacketType(mlir::Operation *op, const xilinx::AIE::AIETargetModel &targetModel, int tileCol, int tileRow, uint32_t packetType)
mlir::Value createConstantI32(mlir::OpBuilder &builder, mlir::Location loc, uint32_t value)
uint32_t getShimBurstLengthEncoding(const AIE::AIETargetModel &tm, uint32_t burstLength)
WireBundle getDMAChannelBundle(DMAChannelDir dir)
The stream-switch bundle the channels of dir use.
V selectGT1(V cond, V t, V e) const
V div(V v, int64_t c) const
V sub(V v, int64_t c) const
mlir::OpBuilder & builder
V selectGT0(V cond, V t, V e) const
V mul(V v, int64_t c) const
V selectLt(V a, V b, V t, V e) const
The register layout of one tile type's DMA buffer descriptor.