Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH] lib/i915/perf: Fix warning on codegen
Date: Wed,  1 May 2024 02:01:45 -0500	[thread overview]
Message-ID: <20240501070145.49810-1-lucas.demarchi@intel.com> (raw)

For a normal string, it's not correct to use just one backslash as
escape char as that conflicts with Python's escape. Use raw strings for
the regex patterns to avoid this problem. Fix the followin warnings:

[4/1809] Generating lib/i915-perf-registers-hsw with a custom command
/home/ldmartin/p/igt-gpu-tools/lib/i915/perf-configs/codegen.py:165: SyntaxWarning: invalid escape sequence '\$'
  m = re.search('\$GtSlice([0-9]+)XeCore([0-9]+)$', name)
/home/ldmartin/p/igt-gpu-tools/lib/i915/perf-configs/codegen.py:168: SyntaxWarning: invalid escape sequence '\$'
  m = re.search('\$GtSlice([0-9]+)$', name)
/home/ldmartin/p/igt-gpu-tools/lib/i915/perf-configs/codegen.py:171: SyntaxWarning: invalid escape sequence '\$'
  m = re.search('\$GtSlice([0-9]+)DualSubslice([0-9]+)$', name)
/home/ldmartin/p/igt-gpu-tools/lib/i915/perf-configs/codegen.py:341: SyntaxWarning: invalid escape sequence '\$'
  m = re.search('\$GtSlice([0-9]+)$', name)
/home/ldmartin/p/igt-gpu-tools/lib/i915/perf-configs/codegen.py:344: SyntaxWarning: invalid escape sequence '\$'
  m = re.search('\$GtSlice([0-9]+)DualSubslice([0-9]+)$', name)
/home/ldmartin/p/igt-gpu-tools/lib/i915/perf-configs/codegen.py:347: SyntaxWarning: invalid escape sequence '\$'
  m = re.search('\$GtSlice([0-9]+)XeCore([0-9]+)$', name)

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/i915/perf-configs/codegen.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/i915/perf-configs/codegen.py b/lib/i915/perf-configs/codegen.py
index 020e76ef4..0d1847592 100644
--- a/lib/i915/perf-configs/codegen.py
+++ b/lib/i915/perf-configs/codegen.py
@@ -162,13 +162,13 @@ hw_vars_mapping = {
 }
 
 def is_hw_var(name):
-    m = re.search('\$GtSlice([0-9]+)XeCore([0-9]+)$', name)
+    m = re.search(r'\$GtSlice([0-9]+)XeCore([0-9]+)$', name)
     if m:
         return True
-    m = re.search('\$GtSlice([0-9]+)$', name)
+    m = re.search(r'\$GtSlice([0-9]+)$', name)
     if m:
         return True
-    m = re.search('\$GtSlice([0-9]+)DualSubslice([0-9]+)$', name)
+    m = re.search(r'\$GtSlice([0-9]+)DualSubslice([0-9]+)$', name)
     if m:
         return True
     return name in hw_vars_mapping
@@ -338,13 +338,13 @@ class Gen:
             return self.hw_vars[name]['c']
         if name in set.counter_vars:
             return set.read_funcs[name] + "(perf, metric_set, accumulator)"
-        m = re.search('\$GtSlice([0-9]+)$', name)
+        m = re.search(r'\$GtSlice([0-9]+)$', name)
         if m:
             return 'intel_perf_devinfo_slice_available(&perf->devinfo, {0})'.format(m.group(1))
-        m = re.search('\$GtSlice([0-9]+)DualSubslice([0-9]+)$', name)
+        m = re.search(r'\$GtSlice([0-9]+)DualSubslice([0-9]+)$', name)
         if m:
             return 'intel_perf_devinfo_subslice_available(&perf->devinfo, {0}, {1})'.format(m.group(1), m.group(2))
-        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_perf_devinfo_subslice_available(&perf->devinfo, {0}, {1})'.format(m.group(1), m.group(2))
         return None
-- 
2.45.0


             reply	other threads:[~2024-05-01  7:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01  7:01 Lucas De Marchi [this message]
2024-05-01  8:19 ` ✗ CI.xeBAT: failure for lib/i915/perf: Fix warning on codegen Patchwork
2024-05-01  8:25 ` ✓ Fi.CI.BAT: success " Patchwork
2024-05-01  9:35 ` ✗ CI.xeFULL: failure " Patchwork
2024-05-01 19:10 ` ✗ Fi.CI.IGT: " Patchwork
2024-05-02 16:22 ` [PATCH] " Gustavo Sousa
2024-05-03 13:39   ` Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240501070145.49810-1-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lionel.g.landwerlin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox