Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/shim/hwctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ get_slotidx() const
return m_handle;
}

size_t
hwctx::
get_num_uc() const
{
return m_col_cnt * 2;
}

xrt_core::cuidx_type
hwctx::
open_cu_context(const std::string& cu_name)
Expand Down
3 changes: 3 additions & 0 deletions src/shim/hwctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class hwctx : public xrt_core::hwctx_handle
slot_id
get_slotidx() const override;

size_t
get_num_uc() const override;

xrt_core::hwqueue_handle*
get_hw_queue() override;

Expand Down
48 changes: 0 additions & 48 deletions src/shim/umq/hwctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ hwctx_umq(const device& device, const xrt::xclbin& xclbin, const qos_type& qos)
m_col_cnt = xp.get_column_cnt();

init_tcp_server(device);
init_log_buf();
}

hwctx_umq::
Expand All @@ -27,8 +26,6 @@ hwctx_umq(const device& device, uint32_t partition_size)
m_col_cnt = partition_size;

init_tcp_server(device);
init_log_buf();
// TODO: configure log BO on the hwctx
shim_debug("Created UMQ HW context (%d)", get_slotidx());
}

Expand All @@ -37,51 +34,6 @@ hwctx_umq::
{
shim_debug("Destroying UMQ HW context (%d)...", get_slotidx());
fini_tcp_server();
// TODO: unconfigure log BO on the hwctx
fini_log_buf();
}

void
hwctx_umq::
init_log_buf()
{
size_t column_size = 4096;
auto log_buf_size = m_col_cnt * column_size;
m_log_bo = std::make_unique<uc_dbg_buffer>
(m_pdev, log_buf_size, AMDXDNA_BO_CMD);
auto log_buf = m_log_bo->vaddr();
std::memset(log_buf, 0, log_buf_size);

auto f = xcl_bo_flags{0};
f.use = XRT_BO_USE_LOG;
f.flags = XRT_BO_FLAGS_CACHEABLE;
f.access = XRT_BO_ACCESS_LOCAL;
f.dir = XRT_BO_ACCESS_READ_WRITE;

m_log_bo->set_flags(f.all);

std::map<uint32_t,size_t> buf_sizes;
set_metadata(buf_sizes, m_col_cnt, column_size);

// TODO: configure log BO on the hwctx once driver and fw support it
// we may use xrt.ini to control the config
m_log_bo->config(this, buf_sizes);
}

void
hwctx_umq::
fini_log_buf(void)
{
// Nothing to do.
}

void
hwctx_umq::
set_metadata(std::map<uint32_t, size_t>& buf_sizes, int num_ucs, size_t size)
{
for (int i = 0; i < num_ucs; i++) {
buf_sizes[i] = size;
}
}

void
Expand Down
7 changes: 0 additions & 7 deletions src/shim/umq/hwctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,13 @@ class hwctx_umq : public hwctx {

private:
const pdev& m_pdev;
std::unique_ptr<buffer> m_log_bo;
uint32_t m_col_cnt = 0;

void *m_log_buf = nullptr;

std::unique_ptr<tcp_server> m_tcp_server;
std::thread m_thread_;

void init_tcp_server(const device& dev);
void fini_tcp_server();

void init_log_buf();
void fini_log_buf();
void set_metadata(std::map<uint32_t, size_t>& buf_size, int num_cols, size_t size);
};

}
Expand Down