Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@getianao
Copy link

@getianao getianao commented Jun 2, 2022

Now rocm_agent_enumerator will raise warnings when meeting unrecognized escape sequences in some versions of Python3.

$ rocm_agent_enumerator
/mnt/sdb1/public/yum/env/v1/spack/opt/spack/linux-centos7-zen/gcc-8.5.0/rocminfo-4.3.1-7fnsjl2k2vvivl6bbda6m2sjtxlyawg2/bin/rocm_agent_enumerator:88: DeprecationWarning: invalid escape sequence \A
  line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)")
/mnt/sdb1/public/yum/env/v1/spack/opt/spack/linux-centos7-zen/gcc-8.5.0/rocminfo-4.3.1-7fnsjl2k2vvivl6bbda6m2sjtxlyawg2/bin/rocm_agent_enumerator:106: DeprecationWarning: invalid escape sequence \w
  target_search_term = re.compile("1002:\w+")
gfx000
gfx908
gfx908
$ python3 --version
Python 3.8.12

This fix uses raw strings to ensure Python not to escape the backslash.

@trixirt
Copy link

trixirt commented Nov 27, 2023

This will become a general problem in the next release on Fedora because rawhide has moved to python 3.12
These warning pollute the use of tools that use rocm_agent_enumerator

$ hipcc --version
/usr/bin/rocm_agent_enumerator:95: SyntaxWarning: invalid escape sequence '\w'
@staticVars(search_name=re.compile("gfx[0-9a-fA-F]+(:[-+:\w]+)?"))
/usr/bin/rocm_agent_enumerator:152: SyntaxWarning: invalid escape sequence '\A'
line_search_term = re.compile("\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)")
/usr/bin/rocm_agent_enumerator:154: SyntaxWarning: invalid escape sequence '\A'
line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)")
/usr/bin/rocm_agent_enumerator:175: SyntaxWarning: invalid escape sequence '\w'
target_search_term = re.compile("1002:\w+")
HIP version: 5.7.31921-
clang version 17.0.4 (Fedora 17.0.4-1.fc40)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@dayatsin-amd dayatsin-amd self-assigned this Nov 27, 2023
@dayatsin-amd dayatsin-amd self-requested a review December 18, 2023 20:02
@dayatsin-amd
Copy link
Contributor

Thank you @getianao patch will be submitted internally and will be part of ROCm 6.1

littlewu2508 added a commit to littlewu2508/rocminfo that referenced this pull request Jan 5, 2024
Use raw strings for regular expression.

This is nearly same with ROCm#55 which
is pulled internally earlier

Reference: https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes
Signed-off-by: Selene <[email protected]>
rocm-ci pushed a commit that referenced this pull request Apr 16, 2024
…cated in Python3

In Python3, unescaped backslashes in regular expressions are deprecated, and these were generating SyntaxWarnings.

Patch submitted by (Tianao Ge <[email protected]>) on github:
#55

Change-Id: Icbcf2803291add5b5f3971ac9901a8927d23f225
jayhawk-commits pushed a commit to ROCm/rocm-systems that referenced this pull request Aug 11, 2025
…cated in Python3

In Python3, unescaped backslashes in regular expressions are deprecated, and these were generating SyntaxWarnings.

Patch submitted by (Tianao Ge <[email protected]>) on github:
ROCm/rocminfo#55

Change-Id: Icbcf2803291add5b5f3971ac9901a8927d23f225


[ROCm/rocminfo commit: 429baf0]
ammallya pushed a commit that referenced this pull request Oct 28, 2025
…cated in Python3

In Python3, unescaped backslashes in regular expressions are deprecated, and these were generating SyntaxWarnings.

Patch submitted by (Tianao Ge <[email protected]>) on github:
#55

Change-Id: Icbcf2803291add5b5f3971ac9901a8927d23f225


[ROCm/rocminfo commit: 429baf0]
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.

3 participants