Commit 44531f6d authored by Lei Wang's avatar Lei Wang Committed by LeiWang1999
Browse files

[Enhancement] Update kernel declaration pattern to support launch bounds in...


[Enhancement] Update kernel declaration pattern to support launch bounds in match_declare_kernel function (#366)

- Modified the regex pattern in `match_declare_kernel` to accommodate optional `__launch_bounds__` specifications, enhancing the function's ability to match kernel declarations accurately.
- This change improves the flexibility of kernel matching in the source code, allowing for more complex kernel definitions.
Co-authored-by: default avatarZhiwen Mo <zhiwen.mo25@ic.ac.uk>
parent d627fd58
...@@ -29,7 +29,7 @@ def match_global_kernel(source: str, annotation: str = "__global__") -> int: ...@@ -29,7 +29,7 @@ def match_global_kernel(source: str, annotation: str = "__global__") -> int:
def match_declare_kernel(source: str, annotation: str = "__global__") -> int: def match_declare_kernel(source: str, annotation: str = "__global__") -> int:
pattern = r"__global__\s+void\s+\w+" pattern = r"__global__\s+void\s+(?:__launch_bounds__\(\d+\)\s+)?\w+"
for line in source.split("\n"): for line in source.split("\n"):
if annotation in line: if annotation in line:
matched = re.findall(pattern, line) matched = re.findall(pattern, line)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment