Skip to content

Commit 31fee81

Browse files
Merge pull request #67 from amd/alex_pcie
PciePlugin
2 parents 26b689e + 15df36e commit 31fee81

File tree

12 files changed

+4300
-17
lines changed

12 files changed

+4300
-17
lines changed

nodescraper/models/taskresult.py

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,40 @@ def duration(self) -> Optional[str]:
103103
return duration
104104

105105
def _get_event_summary(self) -> str:
106-
"""Get summary string for artifacts
106+
"""Get summary string for events
107107
108108
Returns:
109-
str: artifact summary
109+
str: event summary with counts and descriptions
110110
"""
111-
error_count = 0
112-
warning_count = 0
111+
error_msg_counts: dict[str, int] = {}
112+
warning_msg_counts: dict[str, int] = {}
113113

114114
for event in self.events:
115115
if event.priority == EventPriority.WARNING:
116-
warning_count += 1
116+
warning_msg_counts[event.description] = (
117+
warning_msg_counts.get(event.description, 0) + 1
118+
)
117119
elif event.priority >= EventPriority.ERROR:
118-
error_count += 1
119-
120-
summary_list = []
121-
122-
if warning_count:
123-
summary_list.append(f"{warning_count} warnings")
124-
if error_count:
125-
summary_list.append(f"{error_count} errors")
126-
127-
return "|".join(summary_list)
120+
error_msg_counts[event.description] = error_msg_counts.get(event.description, 0) + 1
121+
122+
summary_parts = []
123+
124+
if warning_msg_counts:
125+
total_warnings = sum(warning_msg_counts.values())
126+
warning_details = [
127+
f"{msg} (x{count})" if count > 1 else msg
128+
for msg, count in warning_msg_counts.items()
129+
]
130+
summary_parts.append(f"{total_warnings} warnings: {', '.join(warning_details)}")
131+
132+
if error_msg_counts:
133+
total_errors = sum(error_msg_counts.values())
134+
error_details = [
135+
f"{msg} (x{count})" if count > 1 else msg for msg, count in error_msg_counts.items()
136+
]
137+
summary_parts.append(f"{total_errors} errors: {', '.join(error_details)}")
138+
139+
return "; ".join(summary_parts)
128140

129141
def _update_status(self) -> None:
130142
"""Update overall status based on event priority"""
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
###############################################################################
2+
#
3+
# MIT License
4+
#
5+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
#
25+
###############################################################################
26+
from .analyzer_args import PcieAnalyzerArgs
27+
from .pcie_plugin import PciePlugin
28+
29+
__all__ = ["PciePlugin", "PcieAnalyzerArgs"]
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
#
3+
# MIT License
4+
#
5+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
#
25+
###############################################################################
26+
from typing import Dict, Optional, Union
27+
28+
from nodescraper.models import AnalyzerArgs
29+
30+
31+
class PcieAnalyzerArgs(AnalyzerArgs):
32+
"""Arguments for PCIe analyzer
33+
34+
Attributes:
35+
exp_speed: Expected PCIe speed (generation 1-5)
36+
exp_width: Expected PCIe width (1-16 lanes)
37+
exp_sriov_count: Expected SR-IOV VF count
38+
exp_gpu_count_override: Override expected GPU count
39+
exp_max_payload_size: Expected max payload size (int for all devices, dict for specific device IDs)
40+
exp_max_rd_req_size: Expected max read request size (int for all devices, dict for specific device IDs)
41+
exp_ten_bit_tag_req_en: Expected 10-bit tag request enable (int for all devices, dict for specific device IDs)
42+
"""
43+
44+
exp_speed: int = 5
45+
exp_width: int = 16
46+
exp_sriov_count: int = 0
47+
exp_gpu_count_override: Optional[int] = None
48+
exp_max_payload_size: Optional[Union[Dict[int, int], int]] = None
49+
exp_max_rd_req_size: Optional[Union[Dict[int, int], int]] = None
50+
exp_ten_bit_tag_req_en: Optional[Union[Dict[int, int], int]] = None
51+
52+
53+
def normalize_to_dict(
54+
value: Optional[Union[Dict[int, int], int]], vendorid_ep: int
55+
) -> Dict[int, int]:
56+
"""Normalize int or dict values to dict format using vendorid_ep as key for int values"""
57+
if value is None:
58+
return {}
59+
if isinstance(value, int):
60+
return {vendorid_ep: value}
61+
if isinstance(value, dict):
62+
return value
63+
return {}

0 commit comments

Comments
 (0)