Skip to content

Commit

Permalink
VITIS-9887: xrt support for multiple graph linking and compilation (#…
Browse files Browse the repository at this point in the history
…8030)

* xrt support for multiple graph linking and compilation

Signed-off-by: saumya garg <[email protected]>

xrt support for multiple graph linking and compilation

Signed-off-by: saumya garg <[email protected]>

xrt support for multiple graph linking and compilation

Signed-off-by: saumya garg <[email protected]>

xrt support for multiple graph linking and compilation

Signed-off-by: saumya garg <[email protected]>

xrt support for multiple graph linking and compilation

Signed-off-by: saumya garg <[email protected]>

* fix review comments

Signed-off-by: saumya garg <[email protected]>

fix review comments

Signed-off-by: saumya garg <[email protected]>

---------

Signed-off-by: saumya garg <[email protected]>
Co-authored-by: saumya garg <[email protected]>
  • Loading branch information
saumyag-xilinx and saumya garg authored Mar 23, 2024
1 parent 3abdb38 commit f23d53e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
27 changes: 16 additions & 11 deletions src/runtime_src/core/edge/common/aie_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ using gmio_type = xrt_core::edge::aie::gmio_type;
using counter_type = xrt_core::edge::aie::counter_type;
using module_type = xrt_core::edge::aie::module_type;

static constexpr uint32_t default_id = 1;

inline void
throw_if_error(bool err, const char* msg)
{
Expand Down Expand Up @@ -62,12 +64,12 @@ get_driver_config(const pt::ptree& aie_meta)
driver_config.shim_row = aie_meta.get<uint8_t>("aie_metadata.driver_config.shim_row");
if (!aie_meta.get_optional<uint8_t>("aie_metadata.driver_config.mem_tile_row_start") ||
!aie_meta.get_optional<uint8_t>("aie_metadata.driver_config.mem_tile_num_rows")) {
driver_config.mem_row_start = aie_meta.get<uint8_t>("aie_metadata.driver_config.reserved_row_start");
driver_config.mem_num_rows = aie_meta.get<uint8_t>("aie_metadata.driver_config.reserved_num_rows");
driver_config.mem_row_start = aie_meta.get<uint8_t>("aie_metadata.driver_config.reserved_row_start");
driver_config.mem_num_rows = aie_meta.get<uint8_t>("aie_metadata.driver_config.reserved_num_rows");
}
else {
driver_config.mem_row_start = aie_meta.get<uint8_t>("aie_metadata.driver_config.mem_tile_row_start");
driver_config.mem_num_rows = aie_meta.get<uint8_t>("aie_metadata.driver_config.mem_tile_num_rows");
driver_config.mem_row_start = aie_meta.get<uint8_t>("aie_metadata.driver_config.mem_tile_row_start");
driver_config.mem_num_rows = aie_meta.get<uint8_t>("aie_metadata.driver_config.mem_tile_num_rows");
}
driver_config.aie_tile_row_start = aie_meta.get<uint8_t>("aie_metadata.driver_config.aie_tile_row_start");
driver_config.aie_tile_num_rows = aie_meta.get<uint8_t>("aie_metadata.driver_config.aie_tile_num_rows");
Expand All @@ -83,24 +85,27 @@ get_hw_gen(const pt::ptree& aie_meta)
static uint32_t
get_partition_id(const pt::ptree& aie_meta)
{
auto num_col = aie_meta.get<uint8_t>("aie_metadata.driver_config.partition_num_cols");
auto num_col = aie_meta.get_child_optional("aie_metadata.driver_config.partition_num_cols");
if (!num_col)
return default_id;
auto num_col_value = num_col->get_value<uint32_t>();
auto start_col = 0;
auto overlay_start_cols = aie_meta.get_child_optional("aie_metadata.driver_config.partition_overlay_start_cols");
if (overlay_start_cols && !overlay_start_cols->empty())
start_col = overlay_start_cols->begin()->second.get_value<uint8_t>();
start_col = overlay_start_cols->begin()->second.get_value<uint8_t>();

// AIE Driver expects the partition id format as below
uint32_t part = (num_col << 8U) | (start_col & 0xffU);
uint32_t part = (num_col_value << 8U) | (start_col & 0xffU);
return part;
}

adf::aiecompiler_options
get_aiecompiler_options(const pt::ptree& aie_meta)
{
adf::aiecompiler_options aiecompiler_options;
aiecompiler_options.broadcast_enable_core = aie_meta.get<bool>("aie_metadata.aiecompiler_options.broadcast_enable_core");
aiecompiler_options.event_trace = aie_meta.get("aie_metadata.aiecompiler_options.event_trace", "runtime");
return aiecompiler_options;
adf::aiecompiler_options aiecompiler_options;
aiecompiler_options.broadcast_enable_core = aie_meta.get<bool>("aie_metadata.aiecompiler_options.broadcast_enable_core");
aiecompiler_options.event_trace = aie_meta.get("aie_metadata.aiecompiler_options.event_trace", "runtime");
return aiecompiler_options;
}

adf::graph_config
Expand Down
17 changes: 12 additions & 5 deletions src/runtime_src/core/edge/drm/zocl/edge/zocl_aie.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ zocl_read_aieresbin(struct drm_zocl_dev *zdev, struct axlf* axlf, char __user *x
header = xrt_xclbin_get_section_hdr_next(axlf, AIE_RESOURCES_BIN, header);
while (header) {
int err = 0;
long start_col = 0, num_col = 0;

struct aie_resources_bin *aie_p = (struct aie_resources_bin *)(xclbin + header->m_sectionOffset);
void *data_portion = vmalloc(aie_p->m_image_size);
Expand All @@ -262,12 +263,18 @@ zocl_read_aieresbin(struct drm_zocl_dev *zdev, struct axlf* axlf, char __user *x
return err;
}

if (kstrtol((char*)aie_p +aie_p->m_start_column, 10, &start_col) ||
kstrtol((char*)aie_p +aie_p->m_num_columns, 10, &num_col)) {
vfree(data_portion);
return -EINVAL;
}

//Call the AIE Driver API
//int ret = aie_part_rscmgr_set_static_range(zdev->aie->aie_dev, aie_p->m_start_column, aie_p->m_num_columns, data_portion);
//if (ret != 0) {
// vfree(data_portion);
// return ret;
//}
int ret = aie_part_rscmgr_set_static_range(zdev->aie->aie_dev, start_col, num_col, data_portion);
if (ret != 0) {
vfree(data_portion);
return ret;
}
vfree(data_portion);
header = xrt_xclbin_get_section_hdr_next(axlf, AIE_RESOURCES_BIN, header);
}
Expand Down

0 comments on commit f23d53e

Please sign in to comment.