Module: Mesa
Branch: staging/23.3
Commit: 2525258917532bcc8b3dee6089ee235890e73ec6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2525258917532bcc8b3dee6089ee235890e73ec6

Author: Eric Engestrom <e...@igalia.com>
Date:   Fri Nov 24 09:48:35 2023 +0000

intel/perf: fix regex escaping

`\$` is interpreted before being passed to `re.search()`, but luckily
for us the escape is also invalid and because of that, python 3.12+
warns us about it.

Use a raw string instead, so that the `\` is passed untouched to
`re.search()`.

Fixes: aa04b47c6e43e6cc3561 ("intel/perf: add support for 
GtSlice/GtSliceXDualsubsliceY variables")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26355>
(cherry picked from commit 19420731123e850e10c68eb3cd672b00561c48d7)

---

 .pick_status.json          | 2 +-
 src/intel/perf/gen_perf.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 425b8d9b1d2..d312d3eba13 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -114,7 +114,7 @@
         "description": "intel/perf: fix regex escaping",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "aa04b47c6e43e6cc35611a43c1712ef750f161d9",
         "notes": null
diff --git a/src/intel/perf/gen_perf.py b/src/intel/perf/gen_perf.py
index 4a8b78f4373..1210cde214b 100644
--- a/src/intel/perf/gen_perf.py
+++ b/src/intel/perf/gen_perf.py
@@ -251,10 +251,10 @@ hw_vars["$QueryMode"] = "perf->sys_vars.query_mode"
 def resolve_variable(name, set, allow_counters):
     if name in hw_vars:
         return hw_vars[name]
-    m = re.search('\$GtSlice([0-9]+)$', name)
+    m = re.search(r'\$GtSlice([0-9]+)$', name)
     if m:
         return 'intel_device_info_slice_available(&perf->devinfo, 
{0})'.format(m.group(1))
-    m = re.search('\$GtSlice([0-9]+)XeCore([0-9]+)$', name)
+    m = re.search(r'\$GtSlice([0-9]+)XeCore([0-9]+)$', name)
     if m:
         return 'intel_device_info_subslice_available(&perf->devinfo, {0}, 
{1})'.format(m.group(1), m.group(2))
     if allow_counters and name in set.counter_vars:

Reply via email to