parsing for clang lambda names for SYCL is broken in tblextr.py
Closed this issue · 2 comments
lfmeadow commented
The code in tblextr.py uses regular expressions that do not account for the universe of clang-produced demangled names.
I argue that the right fix for this is to use mangled names everywhere until the final reports.
However, the following patch does work around the problem for SYCL at least, and fixes another problem in ROCM 4.5.0
$ diff -c /opt/rocm-4.5.0/rocprofiler/bin/tblextr.py python/tblextr.py
*** /opt/rocm-4.5.0/rocprofiler/bin/tblextr.py 2021-10-05 14:09:14.000000000 -0400
--- python/tblextr.py 2022-02-02 12:54:33.489606000 -0500
***************
*** 318,332 ****
#############################################################
# arguments manipulation routines
def get_field(args, field):
ptrn1_field = re.compile(r'^.* ' + field + '\(');
! ptrn2_field = re.compile(r'\) .*$');
! ptrn3_field = re.compile(r'\)\)$');
! (field_name, n) = ptrn1_field.subn('', args, count=1);
! if n != 0:
! (field_name, n) = ptrn2_field.subn('', field_name, count=1)
! if n == 0:
! (field_name, n) = ptrn3_field.subn('', field_name, count=1)
! return (field_name, n)
def set_field(args, field, val):
return re.subn(field + '\(\w+\)([ \)])', field + '(' + str(val) + ')\\1', args, count=1)
--- 318,337 ----
#############################################################
# arguments manipulation routines
def get_field(args, field):
+ # rewrite code to handle nested parens properly
+ # this is probably slow
ptrn1_field = re.compile(r'^.* ' + field + '\(');
! o = ptrn1_field.match(args)
! if o == None:
! return ('', 0)
! np = 1
! valstart = o.end(0)
! for i in range(valstart,len(args)):
! if args[i] == '(': np += 1
! if args[i] == ')': np -= 1
! if np == 0:
! break
! return (args[valstart:i-1], 1)
def set_field(args, field, val):
return re.subn(field + '\(\w+\)([ \)])', field + '(' + str(val) + ')\\1', args, count=1)
***************
*** 428,433 ****
--- 433,440 ----
record_id_dict[proc_id] += 1
record_id = record_id_dict[proc_id]
+ if not proc_id in dep_dict: dep_dict[proc_id] = {}
+
# setting correlationid to record id if correlation id is not defined
if corr_id == 0: corr_id = record_id
ppanchad-amd commented
@lfmeadow Has this been in the latest ROCm 6.2? If not, I can create an internal ticket get this fixed. Please let me know. Thanks!
lfmeadow commented
I have no idea. Please go ahead and close the issue.
…________________________________
From: ppanchad-amd ***@***.***>
Sent: Thursday, August 15, 2024 7:11 AM
To: ROCm/roctracer ***@***.***>
Cc: Larry Meadows ***@***.***>; Mention ***@***.***>
Subject: Re: [ROCm/roctracer] parsing for clang lambda names for SYCL is broken in tblextr.py (Issue #71)
@lfmeadow<https://github.com/lfmeadow> Has this been in the latest ROCm 6.2? If not, I can create an internal ticket get this fixed. Please let me know. Thanks!
—
Reply to this email directly, view it on GitHub<#71 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABH5YK6OCW2S6RRUESRDZNDZRSZH5AVCNFSM6AAAAABMSI37YKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJRGM2DAMZSHA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>