Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
adopt transaction API
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Jun 15, 2024
1 parent 745cadf commit 852dc0a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions xaiepy/xrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
namespace py = pybind11;
using namespace py::literals;

// group_id 0 is for npu instructions
// group_id 1 is for number of npu instructions
// host side buffers/args follow starting from position 2
constexpr size_t TRANSACTION_API_OP_CODE = 3;
// group_id 0 is for the op code
// group_id 1 is for npu instructions
// group_id 2 is for number of npu instructions
// host side buffers/args follow starting from position 3
// see aiecc.main.emit_design_kernel_json
constexpr size_t HOST_BUFFERS_START_IDX = 2;
constexpr size_t HOST_BUFFERS_START_IDX = 3;

class PyXCLBin {
public:
Expand Down Expand Up @@ -102,8 +104,9 @@ class PyXCLBin {

void run() {
run_ = std::make_unique<xrt::run>(*kernel);
run_->set_arg(0, *npuInstructions);
run_->set_arg(1, npuInstructions->size());
run_->set_arg(0, TRANSACTION_API_OP_CODE);
run_->set_arg(1, *npuInstructions);
run_->set_arg(2, npuInstructions->size());
for (size_t i = 0; i < buffers.size(); ++i)
run_->set_arg(HOST_BUFFERS_START_IDX + i, *buffers[i]);
run_->start();
Expand Down

0 comments on commit 852dc0a

Please sign in to comment.