Skip to content

Commit

Permalink
Improved the helper, it can also allocate data now.
Browse files Browse the repository at this point in the history
  • Loading branch information
isazi committed Aug 6, 2024
1 parent c83b4ce commit d2ec24a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel_tuner/utils/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,10 @@ def add_present_openacc_fortran(name: str, size: ArraySize) -> str:
return f" present({name}({','.join(md_size)})) "


def process_directives(langs: Code, source: str, user_dimensions: dict = None) -> dict:
def process_directives(langs: Code, source: str, user_dimensions: dict = None) -> tuple(dict, dict):
"""Helper functions to process all the directives in the code and create tunable functions"""
kernel_strings = dict()
kernel_args = dict()
preprocessor = extract_preprocessor(source)
signatures = extract_directive_signature(source, langs)
bodies = extract_directive_code(source, langs)
Expand All @@ -699,4 +700,5 @@ def process_directives(langs: Code, source: str, user_dimensions: dict = None) -
kernel_strings[kernel] = generate_directive_function(
preprocessor, signatures[kernel], bodies[kernel], langs, data[kernel], init, deinit, user_dimensions
)
return kernel_strings
kernel_args[kernel] = allocate_signature_memory(data[kernel], preprocessor, user_dimensions)
return (kernel_strings, kernel_args)

0 comments on commit d2ec24a

Please sign in to comment.