Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
Signed-off-by: saumya garg <[email protected]>
  • Loading branch information
saumya garg committed Jul 12, 2023
1 parent 8395a93 commit 65d662f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 39 deletions.
48 changes: 13 additions & 35 deletions src/runtime_src/core/common/info_aie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ populate_bd_info(const boost::property_tree::ptree& input_pt, boost::property_tr
boost::property_tree::ptree bd_details_array;
int i = 0;
for (const auto& value : value_tree) {
if (i == static_cast<int>(bd_info.size())) i = 0;
std::string val = value.second.data();
boost::property_tree::ptree bd_details_entry;
bd_details_entry.put("name", bd_info[i]);
Expand Down Expand Up @@ -489,16 +488,7 @@ populate_aie_shim(const xrt_core::device *device, const std::string& desc)
}
catch (const qr::no_such_key&) {
// Not Edge device
}
catch (const std::exception& ex) {
pt.put("error_msg", ex.what());
return pt;
}
try {
// On Pcie platforms use driver calls to get AIE Shim info

if (pt_shim.empty())
pt_shim = asd_parser::get_formated_tiles_info(device, asd_parser::aie_tile_type::shim);
pt_shim = asd_parser::get_formated_tiles_info(device, asd_parser::aie_tile_type::shim);
}
catch (const xrt_core::query::no_such_key&) {
// Not Pcie device
Expand All @@ -517,18 +507,17 @@ populate_aie_shim(const xrt_core::device *device, const std::string& desc)
try {
boost::property_tree::ptree tile_array;

auto hw_gen = pt_shim.get<uint8_t>("hw_gen");

// Populate the shim information such as dma, lock, error, events
// for each tiles.
auto hw_gen = pt_shim.get<uint8_t>("aie_shim.hw_gen");
for (const auto& as: pt_shim.get_child("aie_shim")) {
const boost::property_tree::ptree& oshim = as.second;
boost::property_tree::ptree ishim;
if (oshim.find("col") != oshim.not_found()) {
int col = oshim.get<int>("col");
int row = oshim.get<int>("row");
ishim.put("column", col);
ishim.put("row", row);
}
int col = oshim.get<int>("col");
int row = oshim.get<int>("row");
ishim.put("column", col);
ishim.put("row", row);

// Populate DMA information
if (oshim.find("dma") != oshim.not_found())
Expand Down Expand Up @@ -583,16 +572,7 @@ populate_aie_mem(const xrt_core::device* device, const std::string& desc)
}
catch (const xrt_core::query::no_such_key&) {
// Not Edge device
}
catch (const std::exception& ex) {
pt.put("error_msg", ex.what());
return pt;
}

try {
if (pt_mem.empty())
// On Pcie platforms use driver calls to get AIE mem info
pt_mem = asd_parser::get_formated_tiles_info(device, asd_parser::aie_tile_type::mem);
pt_mem = asd_parser::get_formated_tiles_info(device, asd_parser::aie_tile_type::mem);
}
catch (const xrt_core::query::no_such_key&) {
// Not Pcie device
Expand All @@ -616,13 +596,11 @@ populate_aie_mem(const xrt_core::device* device, const std::string& desc)
for (const auto& am: pt_mem.get_child("aie_mem")) {
const boost::property_tree::ptree& imem = am.second;
boost::property_tree::ptree omem;
if (imem.find("col") != imem.not_found()) {
int col = imem.get<uint32_t>("col");
int row = imem.get<uint32_t>("row");
int col = imem.get<uint32_t>("col");
int row = imem.get<uint32_t>("row");

omem.put("column", col);
omem.put("row", row);
}
omem.put("column", col);
omem.put("row", row);

// Populate DMA information
if (imem.find("dma") != imem.not_found())
Expand Down Expand Up @@ -765,7 +743,7 @@ populate_aie_core(const boost::property_tree::ptree& pt_core, boost::property_tr
try {
boost::property_tree::ptree pt;
boost::property_tree::ptree empty_pt;
auto hw_gen = pt_core.get<uint8_t>("aie_core.hw_gen");
auto hw_gen = pt_core.get<uint8_t>("hw_gen");

auto row = tile.get<int>("row");
auto col = tile.get<int>("column");
Expand Down
8 changes: 4 additions & 4 deletions src/runtime_src/core/edge/user/device_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ struct aie_core_info_sysfs
aie_metadata_info aie_meta = get_aie_metadata_info(device);
const std::string aiepart = std::to_string(aie_meta.shim_row) + "_" + std::to_string(aie_meta.num_cols);

ptarray.put("hw_gen",std::to_string(aie_meta.hw_gen));

/* Loop each all aie core tiles and collect core, dma, events, errors, locks status. */
for (int i = 0; i < aie_meta.num_cols; ++i)
for (int j = 0; j < (aie_meta.num_rows-1); ++j)
Expand All @@ -220,6 +218,7 @@ struct aie_core_info_sysfs

boost::property_tree::ptree pt;
pt.add_child("aie_core",ptarray);
pt.put("hw_gen",std::to_string(aie_meta.hw_gen));
std::ostringstream oss;
boost::property_tree::write_json(oss, pt);
std::string inifile_text = oss.str();
Expand All @@ -238,16 +237,17 @@ struct aie_shim_info_sysfs
aie_metadata_info aie_meta = get_aie_metadata_info(device);
const std::string aiepart = std::to_string(aie_meta.shim_row) + "_" + std::to_string(aie_meta.num_cols);

ptarray.put("hw_gen",std::to_string(aie_meta.hw_gen));

/* Loop all shim tiles and collect all dma, events, errors, locks status */
for (int i=0; i < aie_meta.num_cols; ++i) {
ptarray.push_back(std::make_pair(std::to_string(i) + "_" + std::to_string(aie_meta.shim_row),
aie_sys_parser::get_parser(aiepart)->aie_sys_read(i, aie_meta.shim_row)));
std::stringstream a;
boost::property_tree::write_json(a,ptarray);
}

boost::property_tree::ptree pt;
pt.add_child("aie_shim",ptarray);
pt.put("hw_gen",std::to_string(aie_meta.hw_gen));
std::ostringstream oss;
boost::property_tree::write_json(oss, pt);
std::string inifile_text = oss.str();
Expand Down

0 comments on commit 65d662f

Please sign in to comment.