32 کامیت‌ها

مولف SHA1 پیام تاریخ
Mario Limonciello b106e6f175 Run pre-commit's whitespace related hooks on projects/rocminfo (#2115)
In order for pre-commit to be useful, everything needs to meet a common
baseline.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
2025-12-11 15:41:47 -06:00
cfreeamd 7ca8881862 rocminfo: move header comment after opening # line (#1025) 2025-09-16 22:19:26 -07:00
Alysa Liu 7277ecc9a3 rocminfo: Add copyright for new files (#888)
Legal Requirements:

For AMD software being released as open source, add copyright at the top of each new file.

Signed-off-by: Alysa Liu <Alysa.Liu@amd.com>
2025-09-15 11:36:49 -04:00
harkgill-amd 782dc9214b Fix: Error messages printed to stderr to trigger CMake Error Variable (#743)
This PR intends to cover the edge case seen in https://github.com/ROCm/rocm-systems/issues/694. 

`hip-config-amd.cmake` uses rocm_agent_enumerator to determine which GPU architecture to target when no target is specified.
https://github.com/ROCm/rocm-systems/blob/9a02dae75f8df9d8f08923d34d06d76e96ced7b4/projects/clr/hipamd/hip-config-amd.cmake.in#L86-L95

On WSL, both `readFromKFD` and `readFromLSPCI` are skipped. If `readFromTargetLstFile()` isn't in use, `readFromROCMINFO()` is called on. If rocminfo times out, it prints the following message to stdout.
```
"Timeout querying rocminfo.  Are you compiling with more than 254 threads?"
```
Because this is output and not an explicit error message, `execute_command` in the previous code blocks treats the output as `OUTPUT_VARIABLE` and passes it on as a valid gfx arch which causes these errors in CMake,
```
lang++: error: invalid target ID 'Timeout'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-')
    clang++: error: invalid target ID 'querying'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-')
    clang++: error: invalid target ID 'rocminfo.'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-')
    clang++: error: invalid target ID 'Are'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-')
    clang++: error: invalid target ID 'you'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-')
    clang++: error: invalid target ID 'compiling'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-')
```
The output can be properly pushed to `ERROR_VARIABLE` if rocm_agent_enumerator pushes the output to stderr instead of stdout. This can be done with the changes to the print statement in this PR or using the `logging` module.
2025-09-04 15:12:41 -04:00
David Yat Sin a80c19285e rocminfo: Fix comparison to None (#313)
from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations):

> Comparisons to singletons like None should always be done with
is or is not, never the equality operators.

Author: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-08-12 17:14:49 -04:00
Yat Sin, David 6d34b567df Fix for typo in ISA_TO_ID table (#6)
Change-Id: Id0720988fb01079a3ca6f3287dc743d93db4fd0f


[ROCm/rocminfo commit: ac6000dc47]
2025-03-25 10:30:04 -04:00
Khatri, Shweta 5a6a6912d9 Added gfx94x and gfx11xx IDs to enumerator (#5)
[ROCm/rocminfo commit: 9638da7467]
2025-03-07 13:56:43 -05:00
Chris Freehill 425d206003 Support for generic ISAs in rocm_agent_enumerator
Change-Id: Ie6cf2f1930e27afd6564250e108af1f10864946e


[ROCm/rocminfo commit: 7f417dc598]
2025-01-10 10:46:15 -06:00
David Yat Sin 8b1babb9c7 Remove extra print for gfx000
Removing extra print that was added for backward compatibility.

Change-Id: I12a5346708886861a6e3cd6440830e6425e647d9


[ROCm/rocminfo commit: 9f6d7cdf6b]
2024-08-23 18:19:41 +00:00
Shweta Khatri 47be475e1f Use raw strings for regular expression
Makes all re.compile function calls use raw string to prevent Syntax warning in future, if backslash escape characters are used in regular expressions

https: //github.com/ROCm/rocminfo/pull/66
Suggested-by: Author: Yiyang Wu <xgreenlandforwyy@gmail.com

Change-Id: I6c7aaf016c588bb2ae5a0f979da7d423a78d6ec3


[ROCm/rocminfo commit: e1716642ff]
2024-01-18 10:28:58 -05:00
Shweta Khatri 8cc5d1b7f4 Fix invalid escape sequence in rocm_agent_enumerator, which are deprecated in Python3
In Python3, unescaped backslashes in regular expressions are deprecated, and these were generating SyntaxWarnings.

Patch submitted by (Tianao Ge <getianao@gmail.com>) on github:
https://github.com/ROCm/rocminfo/pull/55

Change-Id: Icbcf2803291add5b5f3971ac9901a8927d23f225


[ROCm/rocminfo commit: 429baf04fb]
2024-01-04 19:52:59 +00:00
David Yat Sin 218d9d2a30 Add support for HSA_OVERRIDE_GFX_VERSION env var
Change-Id: Iab75cbbba7da654dbf56f4206900d9c2ff5e4565


[ROCm/rocminfo commit: 3670ff2103]
2023-08-24 18:43:30 +00:00
Mark Searles ee2eb9e46d Fix parsing of rocminfo output for ISAs with no features defined
Patch is an internal port of
 https://github.com/RadeonOpenCompute/rocminfo/pull/59

Change-Id: Iea84f49a60abce73716a7451960c20ee0d2b7bca


[ROCm/rocminfo commit: 34cc693bef]
2023-03-27 08:56:00 -07:00
Mike Li 1c1a0f299c Check permission and handle PermissionError exception
Signed-off-by: Mike Li <Tianxinmike.Li@amd.com>
Change-Id: If7cb8464d0b761e4be45c85eb7147ceed609da61


[ROCm/rocminfo commit: 3a4d533a1e]
2022-08-17 12:23:30 -04:00
David Salinas 66bdb04f62 Handle case with no GPUs
Change-Id: I35b8d4d0c0b6e63d9851d56163686794c7bb8c1e


[ROCm/rocminfo commit: d8f236cd81]
2022-06-17 14:40:44 -04:00
Ashutosh Mishra e785dbbcd5 changeing major_ver of targetlist to decimal
Change-Id: Iada6cf9d2ba3bce4c042dffbf97f1588ffe10a8a


[ROCm/rocminfo commit: 6b4d69d011]
2022-02-03 23:38:24 +05:30
Sean Keely 2328e07883 Handle high levels of concurrency in rocm_agent_enumerator.
rocm_agent_enumerator may invoke rocminfo.  Rocminfo opens the
GPU device which allocates limited resource.  Beyond 254
concurrent processes this resource will be exhausted and rocminfo
will return an error.

This patch loops rocm_agent_enumerator when recieving a failure
message from rocminfo indicating KFD is out of memory.

Change-Id: I8637e214f5fa012642975c28578ae6bf9200eda8


[ROCm/rocminfo commit: b57c02d131]
2021-10-29 20:22:19 -05:00
Joseph Greathouse eed38e469d Add capability to pull gfx architecture from KFD topology
New versions of amdkfd include the gfx architecture version number
for all GPUs surfaced in the HSA topology. This patch adds this as
the preferred way for rocm_agent_enumerator to check for supported
gfx architecture numbers.

Kernels that are missing this feature will not have the value in
the topology. rocm_agent_enumerator will fall back to checking
against the PCI IDs in this case. If PCI IDs fail, we fall back
to the heavyweight rocminfo method.

Change-Id: I5cf22e1069114675092e97ae52331b829cfafb04


[ROCm/rocminfo commit: f419b81bdf]
2021-10-29 20:20:04 -05:00
Joseph Greathouse 0bc0584f0f Switch order of lspci and rocminfo for gfx arch query
rocminfo is a very heavyweight mechanism for learning a lot of
information about the GPUs that are attached to the system.
It opens up the limited /dev/kfd resource to gather lots of
information about each device, while rocm_agent_enumerator really
only wants the gfx number of AMD devices attached to the system.

To avoid this heavyweight lookup in most cases, this patch switches
the order of tests. Rather than starting with rocminfo and then
falling back to a poorly-maintained PCI ID list, this patch changes
the agent enumerator to start by checking in the PCI ID list (fast
case) and then falling back to rocminfo (slow case) if the PCI ID
list is out of date.

Change-Id: If24b8bc3baeeb6adad362abbb288ef3728383bce


[ROCm/rocminfo commit: e9b7de43be]
2021-10-29 20:16:22 -05:00
Joseph Greathouse fc4a486d66 Add better PCI ID backup in rocm_agent_enumerator
The PCI ID backup method in rocm_agent_enumerator, where the
tool uses lspci to find all AMD GPU devices in the system and
manaully match them to gfx version, is extremely outdated. The
PCI ID list did not include anything after Vega 10, and the
actual call to lspci no longer returned anything due to some
missing conversions.

The patch adds all GPUs that might be needed by ROCr up through
Navy Flounder. The PCI ID to gfx matching pulls from the amdgpu
driver and libhsakmt.

Change-Id: I58b77bb6aa631f575352fc444d2542f265909706


[ROCm/rocminfo commit: ea5ce46fb4]
2021-10-29 18:45:23 -05:00
Yi Qian 97c4ab42f4 Add a new rocm_agent_enumerator option '-name' which lists target names obtained from the output of rocminfo.
Change-Id: Iea366c744e2f03a46fd5c902ae4faa94b96f6942


[ROCm/rocminfo commit: e1df81cb8f]
2021-10-29 16:23:01 -05:00
Matt Arsenault c41682dc99 Refer explicitly to python3 in shebang line
On Ubuntu 20.04, there is no more python or python2. Currently I get
this: /usr/bin/env: ‘python’: No such file or directory

Change-Id: Ib310b8aa7c1bd62973ef3cc8bcaf571831ad4435


[ROCm/rocminfo commit: 5d6be5b808]
2020-05-04 09:40:11 -04:00
Chris Freehill aa4f01d778 Fix rocm_agent_enumerator on RHEL
This fixes SWDEV-231760

Change-Id: If704c8ff76548e10ddbda1b5c1ad0c28df7ab6f0


[ROCm/rocminfo commit: 373d8abdec]
2020-04-16 16:39:51 -05:00
Chris Freehill 7d36b45731 Fix ennumerator id parser.
Fixes SWDEV-226018

Change-Id: I14144cdd316c19fe29dcd70b406a52aac8a741cd


[ROCm/rocminfo commit: 70ebe13a89]
2020-03-06 19:50:35 -05:00
Wilfried Holzke 86e8ee885c Added documentation for the new env var.
Change-Id: I0407a5dd36e91a1ea205ce4dda9a7fca906e1266


[ROCm/rocminfo commit: a134847069]
2019-12-16 10:38:47 -06:00
Wilfried Holzke 3960cc7d49 Added env var to set target.lst
Change-Id: Ie6aefba6ef79360e65d4a64a6be1ec50e59b5741


[ROCm/rocminfo commit: 12736c6fd8]
2019-12-16 10:37:33 -06:00
justxi a8c29f0c97 Add files via upload
[ROCm/rocminfo commit: cfbbb52395]
2019-06-19 13:44:12 -05:00
Gregory Stoner dcdd16c795 Update rocm_agent_enumerator
[ROCm/rocminfo commit: fd277f36c0]
2017-12-23 13:09:02 -06:00
Gregory Stoner 149c34aedb Update rocm_agent_enumerator
[ROCm/rocminfo commit: 57a7080ebb]
2017-12-23 13:01:11 -06:00
Gregory Stoner adfa1699c0 Add support for RX580
[ROCm/rocminfo commit: f5334a2ba3]
2017-12-23 13:00:37 -06:00
Wen-Heng (Jack) Chung 45415e7112 Improve error handling logic
[ROCm/rocminfo commit: 6d1234484a]
2017-11-09 13:20:45 -06:00
Wen-Heng (Jack) Chung ec9e027988 Initial commit to introduce rocm_agent_enumerator into rocminfo
This is a python port of rocm_agent_enumerator, which is used by HIP/HCC to
determine available AMDGPU targets on a system.

Its previous implementation was written in C++ which makes it somewhat hard to
deploy onto different distros / architectures. A python port should remove such
issue.


[ROCm/rocminfo commit: 8b018900f6]
2017-11-09 12:33:53 -06:00