6
6
#include " core/common/config_reader.h"
7
7
#include " core/common/message.h"
8
8
#include " xrt/experimental/xrt_module.h"
9
+ #include " xrt/experimental/xrt_aie.h"
9
10
#include " xrt/experimental/xrt_elf.h"
10
11
#include " xrt/experimental/xrt_ext.h"
11
12
@@ -725,6 +726,7 @@ class module_elf : public module_impl
725
726
// module class for ELFs with os_abi - Elf_Amd_Aie2p & ELF_Amd_Aie2p_config
726
727
class module_elf_aie2p : public module_elf
727
728
{
729
+ xrt::aie::program m_program;
728
730
// New Elf of Aie2p contain multiple ctrltext, ctrldata sections
729
731
// sections will be of format .ctrltext.* where .* has index of that section type
730
732
// Below maps has this index as key and value is pair of <section index, data buffer>
@@ -837,8 +839,8 @@ class module_elf_aie2p : public module_elf
837
839
arg.dir = xrt_core::xclbin::kernel_argument::direction::input;
838
840
// if arg has pointer(*) in its name (eg: char*, void*) it is of type global otherwise scalar
839
841
arg.type = (str.find (' *' ) != std::string::npos)
840
- ? xrt_core::xclbin::kernel_argument::argtype::global
841
- : xrt_core::xclbin::kernel_argument::argtype::scalar;
842
+ ? xrt_core::xclbin::kernel_argument::argtype::global
843
+ : xrt_core::xclbin::kernel_argument::argtype::scalar;
842
844
843
845
// At present only global args are supported
844
846
// TODO : Add support for scalar args in ELF flow
@@ -1044,25 +1046,25 @@ class module_elf_aie2p : public module_elf
1044
1046
}
1045
1047
1046
1048
std::string argnm{ symname, symname + std::min (strlen (symname), dynstr->get_size ()) };
1047
- patcher::patch_info pi = patch_scheme == patcher::symbol_type::scalar_32bit_kind ?
1048
- // st_size is is encoded using register value mask for scaler_32
1049
- // for other pacthing scheme it is encoded using size of dma
1050
- patcher::patch_info{ offset, add_end_addr, static_cast <uint32_t >(sym->st_size ) } :
1051
- patcher::patch_info{ offset, add_end_addr, 0 };
1049
+ patcher::patch_info pi = patch_scheme == patcher::symbol_type::scalar_32bit_kind
1050
+ // st_size is is encoded using register value mask for scaler_32
1051
+ // for other pacthing scheme it is encoded using size of dma
1052
+ ? patcher::patch_info{ offset, add_end_addr, static_cast <uint32_t >(sym->st_size ) }
1053
+ : patcher::patch_info{ offset, add_end_addr, 0 };
1052
1054
1053
1055
auto key_string = generate_key_string (argnm, buf_type, sec_index);
1054
1056
1055
1057
if (auto search = m_arg2patcher.find (key_string); search != m_arg2patcher.end ())
1056
1058
search->second .m_ctrlcode_patchinfo .emplace_back (pi );
1057
- else {
1059
+ else
1058
1060
m_arg2patcher.emplace (std::move (key_string), patcher{patch_scheme, {pi }, buf_type});
1059
- }
1060
1061
}
1061
1062
}
1062
1063
1063
1064
public:
1064
1065
explicit module_elf_aie2p (const xrt::elf& elf)
1065
1066
: module_elf{elf}
1067
+ , m_program{elf}
1066
1068
{
1067
1069
initialize_kernel_info ();
1068
1070
initialize_buf (patcher::buf_type::ctrltext, m_instr_buf_map);
@@ -1176,6 +1178,7 @@ class module_elf_aie2p : public module_elf
1176
1178
// module class for ELFs with os_abi - Elf_Amd_Aie2ps
1177
1179
class module_elf_aie2ps : public module_elf
1178
1180
{
1181
+ xrt::aie::program m_program;
1179
1182
std::vector<ctrlcode> m_ctrlcodes;
1180
1183
buf m_dump_buf; // buffer to hold .dump section used for debug/trace
1181
1184
@@ -1405,7 +1408,8 @@ class module_elf_aie2ps : public module_elf
1405
1408
1406
1409
public:
1407
1410
explicit module_elf_aie2ps (const xrt::elf& elf)
1408
- : module_elf(elf)
1411
+ : module_elf{elf}
1412
+ , m_program{elf}
1409
1413
{
1410
1414
std::vector<size_t > pad_offsets;
1411
1415
initialize_column_ctrlcode (pad_offsets);
@@ -2311,8 +2315,8 @@ dump_dtrace_buffer(const xrt::module& module)
2311
2315
2312
2316
} // xrt_core::module_int
2313
2317
2314
- namespace
2315
- {
2318
+ namespace {
2319
+
2316
2320
static std::shared_ptr<xrt::module_elf>
2317
2321
construct_module_elf (const xrt::elf& elf)
2318
2322
{
@@ -2327,13 +2331,14 @@ construct_module_elf(const xrt::elf& elf)
2327
2331
throw std::runtime_error (" unknown ELF type passed\n " );
2328
2332
}
2329
2333
}
2330
- }
2334
+
2335
+ } // namespace
2331
2336
2332
2337
// //////////////////////////////////////////////////////////////
2333
2338
// xrt_module C++ API implementation (xrt_module.h)
2334
2339
// //////////////////////////////////////////////////////////////
2335
- namespace xrt
2336
- {
2340
+ namespace xrt {
2341
+
2337
2342
module::
2338
2343
module (const xrt::elf& elf)
2339
2344
: detail::pimpl<module_impl>(construct_module_elf(elf))
0 commit comments