diff --git a/pytensor/configdefaults.py b/pytensor/configdefaults.py index ca3c44bf6d..7698c5d441 100644 --- a/pytensor/configdefaults.py +++ b/pytensor/configdefaults.py @@ -430,6 +430,13 @@ def add_compile_configvars(): in_c_key=False, ) + config.add( + "compiler_verbose", + "Print information about compilation steps.", + BoolParam(False), + in_c_key=False, + ) + config.add( "on_opt_error", ( diff --git a/pytensor/configparser.py b/pytensor/configparser.py index 328f593fe8..c7da71426d 100644 --- a/pytensor/configparser.py +++ b/pytensor/configparser.py @@ -82,6 +82,7 @@ class PyTensorConfigParser: optimizer: str optimizer_verbose: bool optimizer_verbose_ignore: str + compiler_verbose: bool on_opt_error: str nocleanup: bool on_unused_input: str diff --git a/pytensor/link/numba/dispatch/basic.py b/pytensor/link/numba/dispatch/basic.py index f6e62ae2f8..c871f029c7 100644 --- a/pytensor/link/numba/dispatch/basic.py +++ b/pytensor/link/numba/dispatch/basic.py @@ -285,10 +285,14 @@ def generate_fallback_impl(op, node=None, storage_map=None, **kwargs): """Create a Numba compatible function from a Pytensor `Op`.""" warnings.warn( - f"Numba will use object mode to run {op}'s perform method", + f"Numba will use object mode to run {op}'s perform method. " + f"Set `pytensor.config.compiler_verbose = True` to see more details.", UserWarning, ) + if config.compiler_verbose: + node.dprint(depth=5, print_type=True) + n_outputs = len(node.outputs) if n_outputs > 1: