From a9f8414ba273c2e57a4e97c09683d0131b1ad3ec Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Tue, 5 Oct 2021 15:48:16 -0500 Subject: [PATCH] Use ProcessLogger in LazilyCompilingFunctionCaller to make codegen bottlenecks more visible --- arraycontext/impl/pytato/compile.py | 36 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/arraycontext/impl/pytato/compile.py b/arraycontext/impl/pytato/compile.py index faed2cf..9983d9f 100644 --- a/arraycontext/impl/pytato/compile.py +++ b/arraycontext/impl/pytato/compile.py @@ -41,6 +41,11 @@ import pyopencl.array as cla import pytato as pt import itertools +from pytools import ProcessLogger + +import logging +logger = logging.getLogger(__name__) + # {{{ helper classes: AbstractInputDescriptor @@ -227,20 +232,23 @@ class LazilyCompilingFunctionCaller: import loopy as lp - pt_dict_of_named_arrays = self.actx.transform_dag( - pt.make_dict_of_named_arrays(dict_of_named_arrays)) - - pytato_program = pt.generate_loopy(pt_dict_of_named_arrays, - options=lp.Options( - return_dict=True, - no_numpy=True), - cl_device=self.actx.queue.device) - assert isinstance(pytato_program, BoundPyOpenCLProgram) - - pytato_program = (pytato_program - .with_transformed_program(self - .actx - .transform_loopy_program)) + with ProcessLogger(logger, "transform_dag"): + pt_dict_of_named_arrays = self.actx.transform_dag( + pt.make_dict_of_named_arrays(dict_of_named_arrays)) + + with ProcessLogger(logger, "generate_loopy"): + pytato_program = pt.generate_loopy(pt_dict_of_named_arrays, + options=lp.Options( + return_dict=True, + no_numpy=True), + cl_device=self.actx.queue.device) + assert isinstance(pytato_program, BoundPyOpenCLProgram) + + with ProcessLogger(logger, "transform_loopy_porgram"): + pytato_program = (pytato_program + .with_transformed_program(self + .actx + .transform_loopy_program)) self.program_cache[arg_id_to_descr] = CompiledFunction( self.actx, pytato_program, -- GitLab