From 1f7207939e84af9ecdbc1a4d8d1f9978a2725369 Mon Sep 17 00:00:00 2001 From: Aidyn-A Date: Mon, 7 Jul 2025 15:45:02 +0400 Subject: [PATCH 1/2] use regex --- torch/profiler/_pattern_matcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/profiler/_pattern_matcher.py b/torch/profiler/_pattern_matcher.py index 11a995739480..df48d13a5c20 100644 --- a/torch/profiler/_pattern_matcher.py +++ b/torch/profiler/_pattern_matcher.py @@ -310,7 +310,7 @@ def skip(self): has_tf32 = False else: # Anything less than sm_80 is not Ampere which doesn't support TF32 - has_tf32 = all(int(arch[3:]) >= 80 for arch in torch.cuda.get_arch_list()) + has_tf32 = all(int(re.sub("sm_|compute_", "", arch)) >= 80 for arch in torch.cuda.get_arch_list()) return has_tf32 is False or super().skip or not self.prof.record_shapes def match(self, event: _ProfilerEvent): From 42ce8d8327d66dac8e0818e053847dd95f2598a4 Mon Sep 17 00:00:00 2001 From: Aidyn-A Date: Mon, 7 Jul 2025 16:27:30 +0400 Subject: [PATCH 2/2] fix lint --- torch/profiler/_pattern_matcher.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/torch/profiler/_pattern_matcher.py b/torch/profiler/_pattern_matcher.py index df48d13a5c20..21c56c320892 100644 --- a/torch/profiler/_pattern_matcher.py +++ b/torch/profiler/_pattern_matcher.py @@ -310,7 +310,10 @@ def skip(self): has_tf32 = False else: # Anything less than sm_80 is not Ampere which doesn't support TF32 - has_tf32 = all(int(re.sub("sm_|compute_", "", arch)) >= 80 for arch in torch.cuda.get_arch_list()) + has_tf32 = all( + int(re.sub("sm_|compute_", "", arch)) >= 80 + for arch in torch.cuda.get_arch_list() + ) return has_tf32 is False or super().skip or not self.prof.record_shapes def match(self, event: _ProfilerEvent):