Skip to content

Commit b639c52

Browse files
authored
Slight change to runner and xrt_hw_context to support smi elf flow (#9239)
Signed-off-by: Hayden Laccabue <hlaccabu@amd.com>
1 parent 9a4e177 commit b639c52

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

src/runtime_src/core/common/api/hw_context_int.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ get_module(const xrt::hw_context& hwctx, const std::string& kname);
5656
size_t
5757
get_partition_size(const xrt::hw_context&);
5858

59+
// get_elf_flow() - Returns true if hwctx was created with elf file/flow
60+
// Returns false everywhere else
61+
XRT_CORE_COMMON_EXPORT
62+
bool
63+
get_elf_flow(const xrt::hw_context& ctx);
64+
5965
}} // hw_context_int, xrt_core
6066

6167
#endif

src/runtime_src/core/common/api/xrt_hw_context.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class hw_context_impl : public std::enable_shared_from_this<hw_context_impl>
146146
std::unique_ptr<uc_log_buffer> m_uc_log_buf;
147147
std::shared_ptr<xrt_core::usage_metrics::base_logger> m_usage_logger =
148148
xrt_core::usage_metrics::get_usage_metrics_logger();
149+
bool m_elf_flow = false;
149150

150151
void
151152
create_module_map(const xrt::elf& elf)
@@ -223,6 +224,7 @@ class hw_context_impl : public std::enable_shared_from_this<hw_context_impl>
223224
, m_mode{mode}
224225
, m_hdl{m_core_device->create_hw_context(elf, m_cfg_param, m_mode)}
225226
, m_uc_log_buf(init_uc_log_buf(m_core_device, m_hdl.get()))
227+
, m_elf_flow{true}
226228
{
227229
create_module_map(elf);
228230
}
@@ -350,6 +352,12 @@ class hw_context_impl : public std::enable_shared_from_this<hw_context_impl>
350352
throw std::runtime_error("no module found with given kernel name in ctx");
351353
}
352354

355+
bool
356+
get_elf_flow() const
357+
{
358+
return m_elf_flow;
359+
}
360+
353361
double
354362
get_aie_freq() const
355363
{
@@ -435,6 +443,12 @@ get_partition_size(const xrt::hw_context& ctx)
435443
return ctx.get_handle()->get_partition_size();
436444
}
437445

446+
bool
447+
get_elf_flow(const xrt::hw_context& ctx)
448+
{
449+
return ctx.get_handle()->get_elf_flow();
450+
}
451+
438452
} // xrt_core::hw_context_int
439453

440454
////////////////////////////////////////////////////////////////

src/runtime_src/core/common/runner/runner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,12 @@ class recipe
572572
XRT_DEBUGF("recipe::resources::kernel(%s, %s)\n", m_name.c_str(), m_instance.c_str());
573573
}
574574

575-
// Legacy kernel (alveo)
575+
// Legacy kernel (alveo) or elf file was used when the hwctx was constructed.
576576
kernel(const xrt::hw_context& ctx, std::string name, std::string xname)
577577
: m_name(std::move(name))
578578
, m_instance(std::move(xname))
579579
, m_xclbin_kernel{ctx.get_xclbin().get_kernel(m_instance)}
580-
, m_xrt_kernel{xrt::kernel{ctx, m_instance}}
580+
, m_xrt_kernel{xrt_core::hw_context_int::get_elf_flow(ctx) ? xrt::ext::kernel{ctx, m_instance} : xrt::kernel{ctx, m_instance}}
581581
{
582582
XRT_DEBUGF("recipe::resources::kernel(%s, %s)\n", m_name.c_str(), m_instance.c_str());
583583
}

0 commit comments

Comments
 (0)