Skip to content

Commit 0f2dfa3

Browse files
xdavidzAdvaitNaik
andauthored
shim changes for dump log pr (#738)
Signed-off-by: advanaik <[email protected]> Signed-off-by: David Zhang <[email protected]> Co-authored-by: advanaik <[email protected]>
1 parent 7a81cf3 commit 0f2dfa3

File tree

4 files changed

+10
-55
lines changed

4 files changed

+10
-55
lines changed

src/shim/hwctx.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ get_slotidx() const
176176
return m_handle;
177177
}
178178

179+
size_t
180+
hwctx::
181+
get_num_uc() const
182+
{
183+
return m_col_cnt * 2;
184+
}
185+
179186
xrt_core::cuidx_type
180187
hwctx::
181188
open_cu_context(const std::string& cu_name)

src/shim/hwctx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ class hwctx : public xrt_core::hwctx_handle
6464
slot_id
6565
get_slotidx() const override;
6666

67+
size_t
68+
get_num_uc() const override;
69+
6770
xrt_core::hwqueue_handle*
6871
get_hw_queue() override;
6972

src/shim/umq/hwctx.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ hwctx_umq(const device& device, const xrt::xclbin& xclbin, const qos_type& qos)
1616
m_col_cnt = xp.get_column_cnt();
1717

1818
init_tcp_server(device);
19-
init_log_buf();
2019
}
2120

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

2928
init_tcp_server(device);
30-
init_log_buf();
31-
// TODO: configure log BO on the hwctx
3229
shim_debug("Created UMQ HW context (%d)", get_slotidx());
3330
}
3431

@@ -37,51 +34,6 @@ hwctx_umq::
3734
{
3835
shim_debug("Destroying UMQ HW context (%d)...", get_slotidx());
3936
fini_tcp_server();
40-
// TODO: unconfigure log BO on the hwctx
41-
fini_log_buf();
42-
}
43-
44-
void
45-
hwctx_umq::
46-
init_log_buf()
47-
{
48-
size_t column_size = 4096;
49-
auto log_buf_size = m_col_cnt * column_size;
50-
m_log_bo = std::make_unique<uc_dbg_buffer>
51-
(m_pdev, log_buf_size, AMDXDNA_BO_CMD);
52-
auto log_buf = m_log_bo->vaddr();
53-
std::memset(log_buf, 0, log_buf_size);
54-
55-
auto f = xcl_bo_flags{0};
56-
f.use = XRT_BO_USE_LOG;
57-
f.flags = XRT_BO_FLAGS_CACHEABLE;
58-
f.access = XRT_BO_ACCESS_LOCAL;
59-
f.dir = XRT_BO_ACCESS_READ_WRITE;
60-
61-
m_log_bo->set_flags(f.all);
62-
63-
std::map<uint32_t,size_t> buf_sizes;
64-
set_metadata(buf_sizes, m_col_cnt, column_size);
65-
66-
// TODO: configure log BO on the hwctx once driver and fw support it
67-
// we may use xrt.ini to control the config
68-
m_log_bo->config(this, buf_sizes);
69-
}
70-
71-
void
72-
hwctx_umq::
73-
fini_log_buf(void)
74-
{
75-
// Nothing to do.
76-
}
77-
78-
void
79-
hwctx_umq::
80-
set_metadata(std::map<uint32_t, size_t>& buf_sizes, int num_ucs, size_t size)
81-
{
82-
for (int i = 0; i < num_ucs; i++) {
83-
buf_sizes[i] = size;
84-
}
8537
}
8638

8739
void

src/shim/umq/hwctx.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,13 @@ class hwctx_umq : public hwctx {
2323

2424
private:
2525
const pdev& m_pdev;
26-
std::unique_ptr<buffer> m_log_bo;
2726
uint32_t m_col_cnt = 0;
2827

29-
void *m_log_buf = nullptr;
30-
3128
std::unique_ptr<tcp_server> m_tcp_server;
3229
std::thread m_thread_;
3330

3431
void init_tcp_server(const device& dev);
3532
void fini_tcp_server();
36-
37-
void init_log_buf();
38-
void fini_log_buf();
39-
void set_metadata(std::map<uint32_t, size_t>& buf_size, int num_cols, size_t size);
4033
};
4134

4235
}

0 commit comments

Comments
 (0)