Skip to content

Commit

Permalink
remove legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Jun 18, 2024
1 parent 7826d6e commit 8d426dc
Show file tree
Hide file tree
Showing 25 changed files with 547 additions and 1,306 deletions.
49 changes: 0 additions & 49 deletions compiler/plugins/target/AMD-AIE/aie/AIEDmaToNpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,54 +69,6 @@ struct ShimDMAllocationGetter {
};
} // namespace

struct RtpToNpuPattern : OpConversionPattern<NpuWriteRTPOp> {
using OpConversionPattern::OpConversionPattern;

RtpToNpuPattern(MLIRContext *context, PatternBenefit benefit = 1)
: OpConversionPattern(context, benefit) {}

LogicalResult
matchAndRewrite(NpuWriteRTPOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
auto *ctx = op->getContext();
auto i32ty = IntegerType::get(ctx, 32);
auto ui32ty =
IntegerType::get(ctx, 32, IntegerType::SignednessSemantics::Unsigned);
auto device = op->getParentOfType<AIE::DeviceOp>();

uint32_t rtp_buffer_addr = UINT_MAX;
int c = op.getCol();
int r = op.getRow();
uint32_t v = op.getValue();
uint32_t idx = op.getIndex();

if (auto buffer = device.lookupSymbol<AIE::BufferOp>(op.getBufferSymName()))
if (AIE::TileOp tile = buffer.getTileOp();
tile.colIndex() == c && tile.rowIndex() == r) {
assert(buffer.getAddress().has_value() &&
"buffer must have address assigned");
rtp_buffer_addr = static_cast<uint32_t>(buffer.getAddress().value());
}

if (rtp_buffer_addr == UINT_MAX) {
return op->emitOpError("RTP buffer address cannot be found. Has "
"an RTP buffer been allocated?");
}

rtp_buffer_addr += idx * sizeof(uint32_t);

IntegerAttr column = IntegerAttr::get(i32ty, c);
IntegerAttr row = IntegerAttr::get(i32ty, r);
IntegerAttr address = IntegerAttr::get(ui32ty, rtp_buffer_addr);
IntegerAttr value = IntegerAttr::get(i32ty, v);
rewriter.create<NpuWrite32Op>(op->getLoc(), address.getUInt(),
value.getInt(), column, row);

rewriter.eraseOp(op);
return success();
}
};

struct PushToNpuPattern : OpConversionPattern<NpuPushQueueOp> {

public:
Expand Down Expand Up @@ -416,7 +368,6 @@ struct AIEDmaToNpuPass : xilinx::AIEX::impl::AIEDmaToNpuBase<AIEDmaToNpuPass> {
patterns.insert<DmaToNpuPattern>(&getContext(), cachingGetter);
patterns.insert<DmaWaitToNpuPattern>(&getContext(), cachingGetter);
patterns.insert<PushToNpuPattern>(&getContext());
patterns.insert<RtpToNpuPattern>(&getContext());

if (failed(applyPartialConversion(device, target, std::move(patterns))))
signalPassFailure();
Expand Down
Loading

0 comments on commit 8d426dc

Please sign in to comment.