From 89e0c38d4723cf8a61e7f00dbc9a08e9f40da8e9 Mon Sep 17 00:00:00 2001 From: Johannes M Dieterich Date: Tue, 10 Jul 2018 12:03:16 -0500 Subject: [PATCH] Use generator directly in loop as by review --- tools/amd_build/pyHIPIFY/hipify-python.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/amd_build/pyHIPIFY/hipify-python.py b/tools/amd_build/pyHIPIFY/hipify-python.py index 84ba4b1ea13253..e5d6e27ec30c80 100755 --- a/tools/amd_build/pyHIPIFY/hipify-python.py +++ b/tools/amd_build/pyHIPIFY/hipify-python.py @@ -605,9 +605,8 @@ def get_kernel_template_params(the_file, KernelDictionary): KernelDictionary[kernel_name] = {"kernel_with_template": kernel_with_template, "arg_types": formatted_args} # Extract generated kernels - get_generated_kernels = [k for k in re.finditer(r"GENERATE_KERNEL([1-9])\((.*)\)", string)] # curandStateMtgp32 *state, int size, T *result, ARG1 - for kernel in get_generated_kernels: + for kernel in re.finditer(r"GENERATE_KERNEL([1-9])\((.*)\)", string): kernel_gen_type = int(kernel.group(1)) kernel_name = kernel.group(2).split(",")[0] kernel_params = kernel.group(2).split(",")[1:] @@ -720,8 +719,7 @@ def add_static_casts(directory, extensions, KernelTemplateParams): with openf(filepath, "r+") as fileobj: input_source = fileobj.read() new_output_source = input_source - get_kernel_definitions = [k for k in re.finditer("hipLaunchKernelGGL\(", input_source)] - for kernel in get_kernel_definitions: + for kernel in re.finditer("hipLaunchKernelGGL\(", input_source): arguments = extract_arguments(kernel.end() - 1, input_source) # Check if we have templating + static_cast information