Skip to content

Commit

Permalink
CR-1172341 XRT Test Code fails with 202320.2.16.175 packages (#7667)
Browse files Browse the repository at this point in the history
Move caching of command header to the very first start() of a run object.

In #7608 the internally initialized ert command header is cached as
part of a run object.  The caching is done for repeated invocation of
same run object to reset the header to a known good initial state.
However, caching during construction of the run object is to early for
some use cases where the header is changed in the host code to support
legacy command opcodes.

This PR fixes the problem by delaying caching until the very first
invocation of xrt::run::start().  This allows for host code to
manipulate the underlying command packet, which is necessary for
support of legacy ERT_EXEC_WRITE.
  • Loading branch information
stsoe committed Aug 21, 2023
1 parent 3fbe8c9 commit eba10b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/runtime_src/core/common/api/xrt_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ class run_impl
, core_device(kernel->get_core_device())
, cmd(std::make_shared<kernel_command>(kernel->get_device(), m_hwqueue, kernel->get_hw_context()))
, data(initialize_command(cmd.get()))
, m_header(cmd->get_ert_packet()->header)
, m_header(0)
, uid(create_uid())
{
XRT_DEBUGF("run_impl::run_impl(%d)\n" , uid);
Expand Down Expand Up @@ -2307,6 +2307,12 @@ class run_impl
encode_compute_units();

auto pkt = cmd->get_ert_packet();

// Very first start() of this run object caches the command header
if (!m_header)
m_header = pkt->header;

// The cached command header is used for all subsequent starts
pkt->header = m_header;
pkt->state = ERT_CMD_STATE_NEW;

Expand Down

0 comments on commit eba10b6

Please sign in to comment.