Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VITIS-8548-XRT support to improve AIE status reporting #7619

Merged
merged 4 commits into from
Jul 19, 2023

Conversation

saumyag-xilinx
Copy link
Collaborator

@saumyag-xilinx saumyag-xilinx commented Jul 9, 2023

Problem solved by the commit

https://jira.xilinx.com/browse/VITIS-8548

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

NA

How problem was solved, alternative solutions (if any) and why they were rejected

Reporting bd information (added as sysfs nodes) to the aie reports.

Risks (if any) associated the changes in the commit

Low

What has been tested and how, request additional testing if necessary

Tested on edge platforms. Adding a snippet of the reports below (showing bd info for only 3bds per tile here):

Report of AIE core tile :
xbutil examine -r aie -d

`Aie
Aie_Metadata
GRAPH[ 0] Name : mygraph
Status : unknown
SNo. Core [C:R] Iteration_Memory [C:R] Iteration_Memory_Addresses
[ 0] 24:0 24:1 31460
[ 1] 27:0 27:1 8388

Core [ 0]
Column : 24
Row : 0
Core:
Status : disabled, core_done
Program Counter : 0x000000e6
Link Register : 0x000000d0
Stack Pointer : 0x00037b00
DMA:
MM2S:
Channel:
Id : 0
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 0

            Id                    : 1
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

    S2MM:
        Channel:
            Id                    : 0
            Channel Status        : running
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 1

            Id                    : 1
            Channel Status        : running
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 3

Locks:
    0                     : released_for_write
    1                     : acquired_for_write
    2                     : released_for_write
    3                     : acquired_for_write
    4                     : released_for_write
    5                     : released_for_write
    6                     : released_for_write
    7                     : released_for_write
    8                     : released_for_write
    9                     : released_for_write
    10                    : released_for_write
    11                    : released_for_write
    12                    : released_for_write
    13                    : released_for_write
    14                    : released_for_write
    15                    : released_for_write

Events:
    core                  : 1, 2, 5, 22, 23, 28, 29, 32, 35, 36, 38, 39, 44, 45, 47, 68, 106, 114
    memory                : 1, 20, 21, 22, 25, 26, 33, 34, 43, 44, 45, 46, 48, 49, 50, 106, 113

BDs:
    bd_num:               : 0
    base_address_a        : 1000
    base_address_b        : 0
    length                : 31
    lock_id_a             : 0
    lock_acq_val_a        : 0
    lock_acq_enable_a     : 1
    lock_acq_val_enable_a : 1
    lock_rel_val_a        : 1
    lock_rel_enable_a     : 1
    lock_rel_val_enable_a : 1
    lock_id_b             : 0
    lock_acq_val_b        : 0
    lock_acq_enable_b     : 0
    lock_acq_val_enable_b : 0
    lock_rel_val_b        : 0
    lock_rel_enable_b     : 0
    lock_rel_val_enable_b : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 1
    use_next_bd           : 1
    next_bd_id            : 1
    A_B_buffer_select     : 0
    current_pointer       : 0
    double_buffer_enable  : 0
    interleave_enable     : 0
    interleave_count      : 255
    fifo_mode             : 0
    x_increment           : 0
    x_wrap                : 255
    x_offset              : 1
    y_increment           : 255
    y_wrap                : 255
    y_offset              : 256

    bd_num:               : 1
    base_address_a        : 3f0
    base_address_b        : 0
    length                : 31
    lock_id_a             : 1
    lock_acq_val_a        : 0
    lock_acq_enable_a     : 1
    lock_acq_val_enable_a : 1
    lock_rel_val_a        : 1
    lock_rel_enable_a     : 1
    lock_rel_val_enable_a : 1
    lock_id_b             : 0
    lock_acq_val_b        : 0
    lock_acq_enable_b     : 0
    lock_acq_val_enable_b : 0
    lock_rel_val_b        : 0
    lock_rel_enable_b     : 0
    lock_rel_val_enable_b : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 1
    use_next_bd           : 1
    next_bd_id            : 0
    A_B_buffer_select     : 0
    current_pointer       : 0
    double_buffer_enable  : 0
    interleave_enable     : 0
    interleave_count      : 255
    fifo_mode             : 0
    x_increment           : 0
    x_wrap                : 255
    x_offset              : 1
    y_increment           : 255
    y_wrap                : 255
    y_offset              : 256

    bd_num:               : 2
    base_address_a        : 1800
    base_address_b        : 0
    length                : 31
    lock_id_a             : 2
    lock_acq_val_a        : 0
    lock_acq_enable_a     : 1
    lock_acq_val_enable_a : 1
    lock_rel_val_a        : 1
    lock_rel_enable_a     : 1
    lock_rel_val_enable_a : 1
    lock_id_b             : 0
    lock_acq_val_b        : 0
    lock_acq_enable_b     : 0
    lock_acq_val_enable_b : 0
    lock_rel_val_b        : 0
    lock_rel_enable_b     : 0
    lock_rel_val_enable_b : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 1
    use_next_bd           : 1
    next_bd_id            : 3
    A_B_buffer_select     : 0
    current_pointer       : 0
    double_buffer_enable  : 0
    interleave_enable     : 0
    interleave_count      : 255
    fifo_mode             : 0
    x_increment           : 0
    x_wrap                : 255
    x_offset              : 1
    y_increment           : 255
    y_wrap                : 255
    y_offset              : 256

`
Report of aie shim tile:
xbutil examine -r aieshim -d

`AIE
Shim Status
Tile[ 0]
Tile[ 1]
Column : 0
Row : 0
Events:
pl : 1, 106, 115

Tile[ 2]
Column : 1
Row : 0
Events:
pl : 1, 106, 115

Tile[ 3]
Column : 2
Row : 0
DMA:
FIFO:
Counter0 : 0
Counter1 : 0
MM2S:
Channel:
Id : 0
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 15

            Id                    : 1
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 15

    S2MM:
        Channel:
            Id                    : 0
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 15

            Id                    : 1
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 15

Locks:
    0                     : released_for_write
    1                     : released_for_write
    2                     : released_for_write
    3                     : released_for_write
    4                     : released_for_write
    5                     : released_for_write
    6                     : released_for_write
    7                     : released_for_write
    8                     : released_for_write
    9                     : released_for_write
    10                    : released_for_write
    11                    : released_for_write
    12                    : released_for_write
    13                    : released_for_write
    14                    : released_for_write
    15                    : released_for_write

Events:
    pl                    : 1, 61, 65, 69, 70, 71, 72, 106, 115

BDs:
    bd_num:               : 0
    base_address          : 0
    length                : 0
    lock_id               : 0
    lock_acq_val          : 0
    lock_acq_enable       : 0
    lock_acq_val_enable   : 0
    lock_rel_val          : 0
    lock_rel_enable       : 0
    lock_rel_val_enable   : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 0
    use_next_bd           : 0
    next_bd_id            : 0
    smid                  : 0
    cache                 : 0
    qos                   : 0
    secure_access         : 0
    burst_length          : 0

    bd_num:               : 1
    base_address          : 0
    length                : 0
    lock_id               : 0
    lock_acq_val          : 0
    lock_acq_enable       : 0
    lock_acq_val_enable   : 0
    lock_rel_val          : 0
    lock_rel_enable       : 0
    lock_rel_val_enable   : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 0
    use_next_bd           : 0
    next_bd_id            : 0
    smid                  : 0
    cache                 : 0
    qos                   : 0
    secure_access         : 0
    burst_length          : 0

    bd_num:               : 2
    base_address          : 0
    length                : 0
    lock_id               : 0
    lock_acq_val          : 0
    lock_acq_enable       : 0
    lock_acq_val_enable   : 0
    lock_rel_val          : 0
    lock_rel_enable       : 0
    lock_rel_val_enable   : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 0
    use_next_bd           : 0
    next_bd_id            : 0
    smid                  : 0
    cache                 : 0
    qos                   : 0
    secure_access         : 0
    burst_length          : 0

`

Report of Aie Mem tile:
xbutil examine -r aiemem -d

AIE
Mem Status
Tile[ 0]
Tile[ 1]
Column : 0
Row : 1
DMA:
FIFO:
MM2S:
Channel:
Id : 0
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 0

            Id                    : 1
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 2
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 3
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 4
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 5
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

    S2MM:
        Channel:
            Id                    : 0
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 1
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 2
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 3
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 4
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

            Id                    : 5
            Channel Status        : idle
            Queue Size            : 0
            Queue Status          : okay
            Current BD            : 0

Locks:
    0                     : 0
    1                     : 0
    2                     : 0
    3                     : 0
    4                     : 0
    5                     : 0
    6                     : 0
    7                     : 0
    8                     : 0
    9                     : 0
    10                    : 0
    11                    : 0
    12                    : 0
    13                    : 0
    14                    : 0
    15                    : 0
    16                    : 0
    17                    : 0
    18                    : 0
    19                    : 0
    20                    : 0
    21                    : 0
    22                    : 0
    23                    : 0
    24                    : 0
    25                    : 0
    26                    : 0
    27                    : 0
    28                    : 0
    29                    : 0
    30                    : 0
    31                    : 0
    32                    : 0
    33                    : 0
    34                    : 0
    35                    : 0
    36                    : 0
    37                    : 0
    38                    : 0
    39                    : 0
    40                    : 0
    41                    : 0
    42                    : 0
    43                    : 0
    44                    : 0
    45                    : 0
    46                    : 0
    47                    : 0
    48                    : 0
    49                    : 0
    50                    : 0
    51                    : 0
    52                    : 0
    53                    : 0
    54                    : 0
    55                    : 0
    56                    : 0
    57                    : 0
    58                    : 0
    59                    : 0
    60                    : 0
    61                    : 0
    62                    : 0
    63                    : 0

Events:
    memory_tile           : 1, 141, 149

BDs:
    bd_num:               : 0
    base_address          : 0
    length                : 0
    lock_acq_id           : 0
    lock_acq_val          : 0
    lock_acq_enable       : 0
    lock_rel_id           : 0
    lock_rel_val          : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 0
    use_next_bd           : 0
    next_bd_id            : 0
    tlast_suppress        : 0
    out_of_order_bd_id    : 0
    compression_enable    : 0
    iteration_current     : 0
    iteration_step_size   : 0
    iteration_wrap        : 0
    d0_step_size          : 0
    d0_wrap               : 0
    d1_step_size          : 0
    d1_wrap               : 0
    d1_before             : 0
    d1_after              : 0
    d2_step_size          : 0
    d2_wrap               : 0
    d2_before             : 0
    d2_after              : 0

    bd_num:               : 1
    base_address          : 0
    length                : 0
    lock_acq_id           : 0
    lock_acq_val          : 0
    lock_acq_enable       : 0
    lock_rel_id           : 0
    lock_rel_val          : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 0
    use_next_bd           : 0
    next_bd_id            : 0
    tlast_suppress        : 0
    out_of_order_bd_id    : 0
    compression_enable    : 0
    iteration_current     : 0
    iteration_step_size   : 0
    iteration_wrap        : 0
    d0_step_size          : 0
    d0_wrap               : 0
    d1_step_size          : 0
    d1_wrap               : 0
    d1_before             : 0
    d1_after              : 0
    d2_step_size          : 0
    d2_wrap               : 0
    d2_before             : 0
    d2_after              : 0

    bd_num:               : 2
    base_address          : 0
    length                : 0
    lock_acq_id           : 0
    lock_acq_val          : 0
    lock_acq_enable       : 0
    lock_rel_id           : 0
    lock_rel_val          : 0
    pkt_enable            : 0
    pkt_id                : 0
    pkt_type              : 0
    valid_bd              : 0
    use_next_bd           : 0
    next_bd_id            : 0
    tlast_suppress        : 0
    out_of_order_bd_id    : 0
    compression_enable    : 0
    iteration_current     : 0
    iteration_step_size   : 0
    iteration_wrap        : 0
    d0_step_size          : 0
    d0_wrap               : 0
    d1_step_size          : 0
    d1_wrap               : 0
    d1_before             : 0
    d1_after              : 0
    d2_step_size          : 0
    d2_wrap               : 0
    d2_before             : 0
    d2_after              : 0

Documentation impact (if any)

NA

@gbuildx
Copy link
Collaborator

gbuildx commented Jul 9, 2023

Build failed :(

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

minor fix for build failure

Signed-off-by: saumya garg <[email protected]>
@gbuildx
Copy link
Collaborator

gbuildx commented Jul 10, 2023

Build Passed!

_output << fmt4("%d") % "Column" % tile.second.get<int>("column");
_output << fmt4("%d") % "Row" % tile.second.get<int>("row");

if (tile.second.find("column") != tile.second.not_found()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to add this new check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed, I have now removed it

_output << fmt4("%d") % "Column" % tile.second.get<int>("column");
_output << fmt4("%d") % "Row" % tile.second.get<int>("row");

if (tile.second.find("column") != tile.second.not_found()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to add this new check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

try {
// On Pcie platforms use driver calls to get AIE Shim info
pt_shim = asd_parser::get_formated_tiles_info(device, asd_parser::aie_tile_type::shim);

if (pt_shim.empty())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this new check added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check was added because the pt_shim for edge device will get overwritten with this call for pcie platforms. I have now modified it further to check for pcie platform in the catch of "not edge device".

populate_shim_bd_info_aieml(const boost::property_tree::ptree& input_pt, boost::property_tree::ptree& pt_bd){
std::vector<std::string> bd_info;

bd_info.push_back("base_address");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you know the vector size already, dont use multiple push_back calls as it is going to reallocate your vector again and again.
Either allocate vector with predefined size and push_back, or use initlizer list.

Use in other places too.

Copy link
Collaborator

@chvamshi-xilinx chvamshi-xilinx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also generate property trees before and after your changes and compare the property tree.

@gbuildx
Copy link
Collaborator

gbuildx commented Jul 12, 2023

Build failed :(

@gbuildx
Copy link
Collaborator

gbuildx commented Jul 12, 2023

Build failed :(

Copy link
Collaborator

@chvamshi-xilinx chvamshi-xilinx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, Some small changes requested along with vector initialization.

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra prints

int col = oshim.get<uint32_t>("col");
int row = oshim.get<uint32_t>("row");

int col = oshim.get<int>("col");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to change from uint32_t to int?
Both of them works, but better not to change this.

}

try {
// On Pcie platforms use driver calls to get AIE Shim info
pt_shim = asd_parser::get_formated_tiles_info(device, asd_parser::aie_tile_type::shim);
}
catch (const xrt_core::query::no_such_key&) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two catches are same.. you have to remove one catch...

@gbuildx
Copy link
Collaborator

gbuildx commented Jul 13, 2023

Build Passed!

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

fix review comment

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

fix review comment

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

fix review comment

Signed-off-by: saumya garg <[email protected]>
@gbuildx
Copy link
Collaborator

gbuildx commented Jul 13, 2023

Build Passed!

Copy link
Collaborator

@chvamshi-xilinx chvamshi-xilinx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please generate the json output and verify.

boost::property_tree::ptree bd_details_array;
int i = 0;
for (const auto& value : value_tree) {
std::string val = value.second.data();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const std::string

const boost::property_tree::ptree& bd_node = input_pt.get_child("bd");

for (const auto& pair : bd_node) {
const std::string& key = pair.first;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may need to add a error condition. bd_info size and value_tree size should match,

// This function extract BD information for core tiles of 1st generation aie architecture
void
populate_core_bd_info_aie(const boost::property_tree::ptree& input_pt, boost::property_tree::ptree& pt_bd){
std::vector<std::string> bd_info(35);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static std::vector with initialization list is better. Use in other places too.

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

fix review comment

Signed-off-by: saumya garg <[email protected]>
boost::property_tree::ptree bd_info_array;
const boost::property_tree::ptree& bd_node = input_pt.get_child("bd");

for (const auto& pair : bd_node) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are here you can modernize and clarify a lot your code in a C++17 way https://en.cppreference.com/w/cpp/language/structured_binding

Suggested change
for (const auto& pair : bd_node) {
for (const auto& [ key, value_tree ] : bd_node) {

@gbuildx
Copy link
Collaborator

gbuildx commented Jul 17, 2023

Build Passed!

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

fix review comment

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

fix review comment

Signed-off-by: saumya garg <[email protected]>
@pgschuey pgschuey self-requested a review July 18, 2023 15:23
@gbuildx
Copy link
Collaborator

gbuildx commented Jul 18, 2023

Build Passed!

@chvamshi-xilinx
Copy link
Collaborator

Merging as other teams are waiting for this change.

@chvamshi-xilinx chvamshi-xilinx merged commit 2dd2fb8 into Xilinx:master Jul 19, 2023
@saumyag-xilinx saumyag-xilinx deleted the bd-23.2 branch February 6, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants