From d2ec24a0585f4fa1b50adf41abbd028618193579 Mon Sep 17 00:00:00 2001 From: Alessio Sclocco Date: Tue, 6 Aug 2024 16:40:06 +0200 Subject: [PATCH] Improved the helper, it can also allocate data now. --- kernel_tuner/utils/directives.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel_tuner/utils/directives.py b/kernel_tuner/utils/directives.py index 1d7afb64..b019765b 100644 --- a/kernel_tuner/utils/directives.py +++ b/kernel_tuner/utils/directives.py @@ -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) @@ -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)