From d199a7f8024629ef8067aefd6b56b71c57873a34 Mon Sep 17 00:00:00 2001 From: rbramand Date: Fri, 1 Nov 2024 18:05:56 +0530 Subject: [PATCH] Address comments on PR Signed-off-by: rbramand --- .../core/common/api/hw_context_int.h | 3 + src/runtime_src/core/common/api/module_int.h | 20 +- .../core/common/api/xrt_hw_context.cpp | 28 +-- .../core/common/api/xrt_kernel.cpp | 141 ++++---------- .../core/common/api/xrt_module.cpp | 181 ++++++++++++------ src/runtime_src/core/include/ert.h | 52 ++--- .../core/include/xrt/xrt_hw_context.h | 3 +- 7 files changed, 224 insertions(+), 204 deletions(-) diff --git a/src/runtime_src/core/common/api/hw_context_int.h b/src/runtime_src/core/common/api/hw_context_int.h index 6178e6f920..a2b679395a 100644 --- a/src/runtime_src/core/common/api/hw_context_int.h +++ b/src/runtime_src/core/common/api/hw_context_int.h @@ -44,6 +44,9 @@ XRT_CORE_COMMON_EXPORT xrt::hw_context create_hw_context_from_implementation(void* hwctx_impl); +// Checks all the modules that are registered with given hw context +// and returns the module with the given kernel name +// throws if no module is found with given kernel name xrt::module get_module(const xrt::hw_context& hwctx, const std::string& kname); diff --git a/src/runtime_src/core/common/api/module_int.h b/src/runtime_src/core/common/api/module_int.h index fc5da60a52..72655f382c 100644 --- a/src/runtime_src/core/common/api/module_int.h +++ b/src/runtime_src/core/common/api/module_int.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved. // // Xilinx Runtime (XRT) Experimental APIs @@ -7,6 +7,7 @@ #define _XRT_COMMON_MODULE_INT_H_ // This file defines implementation extensions to the XRT Kernel APIs. +#include "core/common/xclbin_parser.h" #include "core/include/experimental/xrt_bo.h" #include "core/include/experimental/xrt_module.h" @@ -15,6 +16,10 @@ #include namespace xrt_core::module_int { +struct kernel_info { + std::vector args; + xrt_core::xclbin::kernel_properties props; +}; // Fill in ERT command payload in ELF flow. The payload is after extra_cu_mask // and before CU arguments. @@ -57,13 +62,14 @@ get_ert_opcode(const xrt::module& module); void dump_scratchpad_mem(const xrt::module& module); -std::string -get_kernel_signature(const xrt::module& module); +// Returns kernel info extracted from demangled kernel signature +// eg : DPU(void*, void*, void*) +// returns kernel name (DPU), kernel args and kernel properties +// throws exception if Elf passed has no kernel info +const kernel_info& +get_kernel_info(const xrt::module& module); -std::string -get_kernel_name(const xrt::module& module); - -// Get partition size if ELF has info +// Get partition size if ELF has the info uint32_t get_partition_size(const xrt::module& module); diff --git a/src/runtime_src/core/common/api/xrt_hw_context.cpp b/src/runtime_src/core/common/api/xrt_hw_context.cpp index b1dbe22be3..e1cd4cbc6e 100644 --- a/src/runtime_src/core/common/api/xrt_hw_context.cpp +++ b/src/runtime_src/core/common/api/xrt_hw_context.cpp @@ -70,12 +70,15 @@ class hw_context_impl : public std::enable_shared_from_this , m_cfg_param{std::move(cfg_param)} , m_mode{mode} { + // Create module object to parse Elf auto module = xrt::module(elf); - auto kernel_name = xrt_core::module_int::get_kernel_name(module); - m_module_map[kernel_name] = std::move(module); - - m_partition_size = xrt_core::module_int::get_partition_size(m_module_map.begin()->second); + // Get partition size and pass it to diver for hw ctx creation + m_partition_size = xrt_core::module_int::get_partition_size(module); m_hdl = m_core_device->create_hw_context(m_partition_size, m_cfg_param, mode); + + // creation successful, store the module in the map + auto kernel_name = xrt_core::module_int::get_kernel_info(module).props.name; + m_module_map[kernel_name] = std::move(module); } std::shared_ptr @@ -110,7 +113,7 @@ class hw_context_impl : public std::enable_shared_from_this add_config(const xrt::elf& elf) { auto module = xrt::module(elf); - auto kernel_name = xrt_core::module_int::get_kernel_name(module); + auto kernel_name = xrt_core::module_int::get_kernel_info(module).props.name; auto part_size = xrt_core::module_int::get_partition_size(module); // create hw ctx handle if not already created @@ -127,10 +130,8 @@ class hw_context_impl : public std::enable_shared_from_this throw std::runtime_error("can not add config to ctx with different configuration\n"); // add module to map if kernel name is different, else throw - for (const auto& m : m_module_map) { - if (kernel_name == xrt_core::module_int::get_kernel_name(m.second)) - throw std::runtime_error("config with kernel already exists, cannot add this config\n"); - } + if (m_module_map.find(kernel_name) != m_module_map.end()) + throw std::runtime_error("config with kernel already exists, cannot add this config\n"); m_module_map[kernel_name] = std::move(module); } @@ -186,11 +187,10 @@ class hw_context_impl : public std::enable_shared_from_this xrt::module get_module(const std::string& kname) const { - for (const auto& m : m_module_map) { - if (kname == xrt_core::module_int::get_kernel_name(m.second)) - return m.second; - } - throw std::runtime_error("no module found with given kernel name in ctx"); + auto itr = m_module_map.find(kname); + if (itr == m_module_map.end()) + throw std::runtime_error("no module found with given kernel name in ctx"); + return itr->second; } }; diff --git a/src/runtime_src/core/common/api/xrt_kernel.cpp b/src/runtime_src/core/common/api/xrt_kernel.cpp index fce31d4bec..1705a6d47a 100644 --- a/src/runtime_src/core/common/api/xrt_kernel.cpp +++ b/src/runtime_src/core/common/api/xrt_kernel.cpp @@ -1306,7 +1306,7 @@ class kernel_impl : public std::enable_shared_from_this xrt::xclbin::kernel xkernel; // kernel xclbin metadata std::vector args; // kernel args sorted by argument index std::vector ipctxs; // CU context locks - property_type properties; // Kernel properties from XML meta + const property_type& properties; // Kernel properties from XML meta std::bitset cumask; // cumask for command execution size_t regmap_size = 0; // CU register map size size_t fa_num_inputs = 0; // Fast adapter number of inputs per meta data @@ -1505,6 +1505,41 @@ class kernel_impl : public std::enable_shared_from_this return data; // no skipping } + xrt::module + get_module(const xrt::hw_context& ctx, const std::string& kname) + { + // ELF use case, identify module from ctx that has given kernel name and + // get kernel signature from the module to construct kernel args etc + // kernel name will be of format - : + auto i = kname.find(":"); + if (i == std::string::npos) { + // default case - ctrl code 0 will be used + name = kname.substr(0, kname.size()); + m_ctrl_code_index = 0; + } + else { + name = kname.substr(0, i); + m_ctrl_code_index = std::stoul(kname.substr(i+1, kname.size()-i-1)); + } + + return xrt_core::hw_context_int::get_module(ctx, name); + } + + const property_type& + get_elf_kernel_properties() + { + // Get kernel info from module + const auto& kernel_info = xrt_core::module_int::get_kernel_info(m_module); + if (name != kernel_info.props.name) + throw std::runtime_error("Kernel name mismatch, incorrect module picked\n"); + + // set kernel args + for (auto& arg : kernel_info.args) + args.emplace_back(arg); + + return kernel_info.props; + } + static uint32_t create_uid() { @@ -1521,64 +1556,6 @@ class kernel_impl : public std::enable_shared_from_this throw xrt_core::error("No such kernel '" + nm + "'"); } - static std::vector - split(const std::string& s, char delimiter) - { - std::vector tokens; - std::stringstream ss(s); - std::string item; - - while (getline(ss, item, delimiter)) - tokens.push_back(item); - - return tokens; - } - - void - construct_elf_kernel_args(const std::string& kernel_name) - { - // kernel signature - name(argtype, argtype ...) - size_t start_pos = kernel_name.find('('); - size_t end_pos = kernel_name.find(')', start_pos); - - if (start_pos == std::string::npos || end_pos == std::string::npos || start_pos > end_pos) - throw std::runtime_error("Failed to construct kernel args"); - - std::string argstring = kernel_name.substr(start_pos + 1, end_pos - start_pos - 1); - std::vector argstrings = split(argstring, ','); - - size_t count = 0; - size_t offset = 0; - for (const std::string& str : argstrings) { - xrt_core::xclbin::kernel_argument arg; - arg.name = "argv" + std::to_string(count); - arg.hosttype = "no-type"; - arg.port = "no-port"; - arg.index = count; - arg.offset = offset; - arg.dir = xrt_core::xclbin::kernel_argument::direction::input; - // if arg has pointer(*) in its name (eg: char*, void*) it is of type global otherwise scalar - arg.type = (str.find('*') != std::string::npos) - ? xrt_core::xclbin::kernel_argument::argtype::global - : xrt_core::xclbin::kernel_argument::argtype::scalar; - - // At present only global args are supported - // TODO : Add support for scalar args in ELF flow - if (arg.type == xrt_core::xclbin::kernel_argument::argtype::scalar) - throw std::runtime_error("scalar args are not yet supported for this kind of kernel"); - else { - // global arg - static constexpr size_t global_arg_size = 0x8; - arg.size = global_arg_size; - - offset += global_arg_size; - } - - args.emplace_back(arg); - count++; - } - } - public: // kernel_type - constructor // @@ -1639,51 +1616,17 @@ class kernel_impl : public std::enable_shared_from_this } kernel_impl(std::shared_ptr dev, xrt::hw_context ctx, const std::string& nm) - : device(std::move(dev)) // share ownership - , hwctx(std::move(ctx)) // hw context - , hwqueue(hwctx) // hw queue + : device(std::move(dev)) // share ownership + , hwctx(std::move(ctx)) // hw context + , hwqueue(hwctx) // hw queue + , m_module(get_module(hwctx, nm)) // module object with matching kernel name + , properties(get_elf_kernel_properties()) // kernel info present in Elf , uid(create_uid()) { XRT_DEBUGF("kernel_impl::kernel_impl(%d)\n", uid); - // ELF use case, identify module from ctx that has given kernel name and - // get kernel signature from the module to construct kernel args etc - - // kernel name will be of format - : - auto i = nm.find(":"); - if (i == std::string::npos) { - // default case - ctrl code 0 will be used - name = nm.substr(0, nm.size()); - m_ctrl_code_index = 0; - } - else { - name = nm.substr(0, i); - m_ctrl_code_index = std::stoul(nm.substr(i+1, nm.size()-i-1)); - } - - m_module = xrt_core::hw_context_int::get_module(hwctx, name); - auto demangled_name = xrt_core::module_int::get_kernel_signature(m_module); - - // extract kernel name - size_t pos = demangled_name.find('('); - if (pos == std::string::npos) - throw std::runtime_error("Failed to get kernel - " + nm); - - if (name != demangled_name.substr(0, pos)) - throw std::runtime_error("Kernel name mismatch, incorrect module picked\n"); - - construct_elf_kernel_args(demangled_name); - - // fill kernel properties - properties.name = name; - properties.type = xrt_core::xclbin::kernel_properties::kernel_type::dpu; - properties.counted_auto_restart = xrt_core::xclbin::get_restart_from_ini(name); - properties.mailbox = xrt_core::xclbin::get_mailbox_from_ini(name); - properties.sw_reset = xrt_core::xclbin::get_sw_reset_from_ini(name); - // amend args with computed data based on kernel protocol amend_args(); - m_usage_logger->log_kernel_info(device->core_device.get(), hwctx, name, args.size()); } @@ -2174,7 +2117,7 @@ class run_impl auto kcmd = pkt->get_ert_cmd(); auto payload = kernel->initialize_command(pkt); if (kcmd->opcode == ERT_START_DPU || kcmd->opcode == ERT_START_NPU || kcmd->opcode == ERT_START_NPU_PREEMPT || - kcmd->opcode == ERT_START_NPU_PDI_IN_ELF) { + kcmd->opcode == ERT_START_NPU_PREEMPT_ELF) { auto payload_past_dpu = initialize_dpu(payload); // adjust count to include the prepended ert_dpu_data structures diff --git a/src/runtime_src/core/common/api/xrt_module.cpp b/src/runtime_src/core/common/api/xrt_module.cpp index de89529952..979da54fe2 100644 --- a/src/runtime_src/core/common/api/xrt_module.cpp +++ b/src/runtime_src/core/common/api/xrt_module.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved. // SPDX-License-Identifier: Apache-2.0 #define XCL_DRIVER_DLL_EXPORT // exporting xrt_module.h #define XRT_API_SOURCE // exporting xrt_module.h @@ -522,16 +522,9 @@ class module_impl throw std::runtime_error("Not supported"); } - // get kernel signature in demmangled format - [[nodiscard]] virtual std::string - get_kernel_signature() const - { - throw std::runtime_error("Not supported"); - } - - // get only kernel name without args from kernel signature - [[nodiscard]] virtual std::string - get_kernel_name() const + // get kernel info (name, properties and args) if elf has the info + [[nodiscard]] virtual const xrt_core::module_int::kernel_info& + get_kernel_info() const { throw std::runtime_error("Not supported"); } @@ -685,7 +678,8 @@ class module_elf_aie2p : public module_elf size_t m_scratch_pad_mem_size = 0; uint32_t m_partition_size = UINT32_MAX; - std::string m_kernel_signature; + + xrt_core::module_int::kernel_info m_kernel_info; static uint32_t get_section_name_index(const std::string& name) @@ -717,14 +711,15 @@ class module_elf_aie2p : public module_elf m_partition_size = std::stoul(std::string{static_cast(desc), desc_size}); } - void - initialize_kernel_signature() + std::string + get_kernel_signature() { static constexpr const char* symtab_section_name {".symtab"}; + std::string kernel_signature = ""; ELFIO::section* symtab = m_elfio.sections[symtab_section_name]; if (!symtab) - return; // elf doesn't have .symtab section, kernel_signature will be empty string + return kernel_signature; // elf doesn't have .symtab section, kernel_signature will be empty string // Get the symbol table const ELFIO::symbol_section_accessor symbols(m_elfio, symtab); @@ -743,11 +738,95 @@ class module_elf_aie2p : public module_elf // there will be only 1 kernel signature symbol entry in .symtab section whose // type is FUNC if (type == ELFIO::STT_FUNC) { - m_kernel_signature = demangle(name); + kernel_signature = demangle(name); break; } } } + return kernel_signature; + } + + static std::vector + split(const std::string& s, char delimiter) + { + std::vector tokens; + std::stringstream ss(s); + std::string item; + + while (getline(ss, item, delimiter)) + tokens.push_back(item); + + return tokens; + } + + static std::vector + construct_kernel_args(const std::string& signature) + { + std::vector args; + + // kernel signature - name(argtype, argtype ...) + size_t start_pos = signature.find('('); + size_t end_pos = signature.find(')', start_pos); + + if (start_pos == std::string::npos || end_pos == std::string::npos || start_pos > end_pos) + throw std::runtime_error("Failed to construct kernel args"); + + std::string argstring = signature.substr(start_pos + 1, end_pos - start_pos - 1); + std::vector argstrings = split(argstring, ','); + + size_t count = 0; + size_t offset = 0; + for (const std::string& str : argstrings) { + xrt_core::xclbin::kernel_argument arg; + arg.name = "argv" + std::to_string(count); + arg.hosttype = "no-type"; + arg.port = "no-port"; + arg.index = count; + arg.offset = offset; + arg.dir = xrt_core::xclbin::kernel_argument::direction::input; + // if arg has pointer(*) in its name (eg: char*, void*) it is of type global otherwise scalar + arg.type = (str.find('*') != std::string::npos) + ? xrt_core::xclbin::kernel_argument::argtype::global + : xrt_core::xclbin::kernel_argument::argtype::scalar; + + // At present only global args are supported + // TODO : Add support for scalar args in ELF flow + if (arg.type == xrt_core::xclbin::kernel_argument::argtype::scalar) + throw std::runtime_error("scalar args are not yet supported for this kind of kernel"); + else { + // global arg + static constexpr size_t global_arg_size = 0x8; + arg.size = global_arg_size; + + offset += global_arg_size; + } + + args.emplace_back(arg); + count++; + } + return args; + } + + void + initialize_kernel_info() + { + auto kernel_signature = get_kernel_signature(); + // extract kernel name + size_t pos = kernel_signature.find('('); + if (pos == std::string::npos) + return; // Elf doesn't contain kernel info aie2p type + std::string kernel_name = kernel_signature.substr(0, pos); + + // construct kernel args and properties and cache them + // this info is used at the time of xrt::kernel object creation + m_kernel_info.args = construct_kernel_args(kernel_signature); + + // fill kernel properties + m_kernel_info.props.name = kernel_name; + m_kernel_info.props.type = xrt_core::xclbin::kernel_properties::kernel_type::dpu; + m_kernel_info.props.counted_auto_restart = xrt_core::xclbin::get_restart_from_ini(kernel_name); + m_kernel_info.props.mailbox = xrt_core::xclbin::get_mailbox_from_ini(kernel_name); + m_kernel_info.props.sw_reset = xrt_core::xclbin::get_sw_reset_from_ini(kernel_name); } // Extract buffer from ELF sections without assuming anything @@ -908,7 +987,7 @@ class module_elf_aie2p : public module_elf : module_elf(elf) { initialize_partition_size(); - initialize_kernel_signature(); + initialize_kernel_info(); initialize_buf(patcher::buf_type::ctrltext, m_instr_buf_map); initialize_buf(patcher::buf_type::ctrldata, m_ctrl_packet_map); @@ -929,7 +1008,7 @@ class module_elf_aie2p : public module_elf get_ert_opcode() const override { if (!m_pdi_buf_map.empty()) - return ERT_START_NPU_PDI_IN_ELF; + return ERT_START_NPU_PREEMPT_ELF; if (m_save_buf_exist && m_restore_buf_exist) return ERT_START_NPU_PREEMPT; @@ -996,23 +1075,13 @@ class module_elf_aie2p : public module_elf return m_partition_size; } - [[nodiscard]] virtual std::string - get_kernel_signature() const override + [[nodiscard]] virtual const xrt_core::module_int::kernel_info& + get_kernel_info() const override { - if (m_kernel_signature.empty()) - throw std::runtime_error("No kernel signature available, wrong ELF passed\n"); - return m_kernel_signature; - } - - [[nodiscard]] virtual std::string - get_kernel_name() const override - { - std::string demangled_name = get_kernel_signature(); - // extract kernel name - size_t pos = demangled_name.find('('); - if (pos == std::string::npos) - throw std::runtime_error("Failed to get kernel name"); - return demangled_name.substr(0, pos); + // sanity to check if kernel info is available by checking kernel name is empty + if (m_kernel_info.props.name.empty()) + throw std::runtime_error("No kernel info available, wrong ELF passed\n"); + return m_kernel_info; } }; @@ -1628,16 +1697,19 @@ class module_sram : public module_impl { auto os_abi = m_parent.get()->get_os_abi(); - if (os_abi == Elf_Amd_Aie2ps) - return fill_ert_aie2ps(payload); - else if (os_abi == Elf_Amd_Aie2p_config) - return fill_ert_aie2p_preempt_data(payload); - - // os abi is Elf_Amd_Aie2p - if (m_preempt_save_bo && m_preempt_restore_bo) + switch (os_abi) { + case Elf_Amd_Aie2p : + if (m_preempt_save_bo && m_preempt_restore_bo) + return fill_ert_aie2p_preempt_data(payload); + else + return fill_ert_aie2p_non_preempt_data(payload); + case Elf_Amd_Aie2p_config : return fill_ert_aie2p_preempt_data(payload); - else - return fill_ert_aie2p_non_preempt_data(payload); + case Elf_Amd_Aie2ps : + return fill_ert_aie2ps(payload); + default : + throw std::runtime_error("unknown ELF type passed\n"); + } } [[nodiscard]] virtual xrt::bo& @@ -1713,13 +1785,14 @@ patch(const xrt::module& module, uint8_t* ibuf, size_t* sz, const std::vectorget_os_abi(); - if (hdl->get_os_abi() == Elf_Amd_Aie2p || Elf_Amd_Aie2p_config) { - instr_buf buf; - std::tie(patch_index, buf) = hdl->get_instr(idx); - inst = &buf; + if (os_abi == Elf_Amd_Aie2p || os_abi == Elf_Amd_Aie2p_config) { + const auto& buf_info = hdl->get_instr(idx); + patch_index = buf_info.first; + inst = &(buf_info.second); } - else if(hdl->get_os_abi() == Elf_Amd_Aie2ps) { + else if(os_abi == Elf_Amd_Aie2ps) { const auto& instr_buf = hdl->get_data(); if (instr_buf.size() != 1) throw std::runtime_error{"Patch failed: only support patching single column"}; @@ -1776,16 +1849,10 @@ dump_scratchpad_mem(const xrt::module& module) module_sram->dump_scratchpad_mem(); } -std::string -get_kernel_name(const xrt::module& module) -{ - return module.get_handle()->get_kernel_name(); -} - -std::string -get_kernel_signature(const xrt::module& module) +const xrt_core::module_int::kernel_info& +get_kernel_info(const xrt::module& module) { - return module.get_handle()->get_kernel_signature(); + return module.get_handle()->get_kernel_info(); } uint32_t diff --git a/src/runtime_src/core/include/ert.h b/src/runtime_src/core/include/ert.h index 1c79819a38..758f77d781 100644 --- a/src/runtime_src/core/include/ert.h +++ b/src/runtime_src/core/include/ert.h @@ -626,29 +626,29 @@ struct cu_cmd_state_timestamps { * @ERT_START_NPU_PREEMPT: instruction buffer command with preemption format on NPU */ enum ert_cmd_opcode { - ERT_START_CU = 0, - ERT_START_KERNEL = 0, - ERT_CONFIGURE = 2, - ERT_EXIT = 3, - ERT_ABORT = 4, - ERT_EXEC_WRITE = 5, - ERT_CU_STAT = 6, - ERT_START_COPYBO = 7, - ERT_SK_CONFIG = 8, - ERT_SK_START = 9, - ERT_SK_UNCONFIG = 10, - ERT_INIT_CU = 11, - ERT_START_FA = 12, - ERT_CLK_CALIB = 13, - ERT_MB_VALIDATE = 14, - ERT_START_KEY_VAL = 15, - ERT_ACCESS_TEST_C = 16, - ERT_ACCESS_TEST = 17, - ERT_START_DPU = 18, - ERT_CMD_CHAIN = 19, - ERT_START_NPU = 20, - ERT_START_NPU_PREEMPT = 21, - ERT_START_NPU_PDI_IN_ELF = 22, + ERT_START_CU = 0, + ERT_START_KERNEL = 0, + ERT_CONFIGURE = 2, + ERT_EXIT = 3, + ERT_ABORT = 4, + ERT_EXEC_WRITE = 5, + ERT_CU_STAT = 6, + ERT_START_COPYBO = 7, + ERT_SK_CONFIG = 8, + ERT_SK_START = 9, + ERT_SK_UNCONFIG = 10, + ERT_INIT_CU = 11, + ERT_START_FA = 12, + ERT_CLK_CALIB = 13, + ERT_MB_VALIDATE = 14, + ERT_START_KEY_VAL = 15, + ERT_ACCESS_TEST_C = 16, + ERT_ACCESS_TEST = 17, + ERT_START_DPU = 18, + ERT_CMD_CHAIN = 19, + ERT_START_NPU = 20, + ERT_START_NPU_PREEMPT = 21, + ERT_START_NPU_PREEMPT_ELF = 22, }; /** @@ -986,7 +986,7 @@ ert_valid_opcode(struct ert_packet *pkt) /* 1 mandatory cumask + extra_cu_masks + ert_npu_preempt_data */ valid = (skcmd->count >= 1+ skcmd->extra_cu_masks + sizeof(struct ert_npu_preempt_data) / sizeof(uint32_t)); break; - case ERT_START_NPU_PDI_IN_ELF: + case ERT_START_NPU_PREEMPT_ELF: skcmd = to_start_krnl_pkg(pkt); /* 1 mandatory cumask + extra_cu_masks + ert_npu_preempt_data */ valid = (skcmd->count >= 1+ skcmd->extra_cu_masks + sizeof(struct ert_npu_preempt_data) / sizeof(uint32_t)); @@ -1103,7 +1103,7 @@ get_ert_npu_preempt_data(struct ert_start_kernel_cmd* pkt) static inline struct ert_npu_preempt_data* get_ert_npu_elf_data(struct ert_start_kernel_cmd* pkt) { - if (pkt->opcode != ERT_START_NPU_PDI_IN_ELF) + if (pkt->opcode != ERT_START_NPU_PREEMPT_ELF) return NULL; // past extra cu_masks embedded in the packet data return (struct ert_npu_preempt_data*) (pkt->data + pkt->extra_cu_masks); @@ -1127,7 +1127,7 @@ get_ert_regmap_begin(struct ert_start_kernel_cmd* pkt) + sizeof(struct ert_npu_preempt_data) / sizeof(uint32_t) + get_ert_npu_preempt_data(pkt)->instruction_prop_count; - case ERT_START_NPU_PDI_IN_ELF: + case ERT_START_NPU_PREEMPT_ELF: return pkt->data + pkt->extra_cu_masks + sizeof(struct ert_npu_preempt_data) / sizeof(uint32_t) + get_ert_npu_elf_data(pkt)->instruction_prop_count; diff --git a/src/runtime_src/core/include/xrt/xrt_hw_context.h b/src/runtime_src/core/include/xrt/xrt_hw_context.h index 9321d818fa..103a67e419 100644 --- a/src/runtime_src/core/include/xrt/xrt_hw_context.h +++ b/src/runtime_src/core/include/xrt/xrt_hw_context.h @@ -89,7 +89,8 @@ class hw_context : public detail::pimpl * Access control for the context * * When application uses this constructor no hw resources are allocated - * It acts as placeholder and used for setting QoS and access control + * It acts as placeholder and is used for setting QoS and access control + * Applications can later add configuration Elfs using add_config api. * The QoS definition is subject to change, so this API is not guaranteed * to be ABI compatible in future releases */