Skip to content

Add compiler_verbose config flag #1520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pytensor/configdefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
(
Expand Down
1 change: 1 addition & 0 deletions pytensor/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion pytensor/link/numba/dispatch/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,14 @@
"""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)

Check warning on line 294 in pytensor/link/numba/dispatch/basic.py

View check run for this annotation

Codecov / codecov/patch

pytensor/link/numba/dispatch/basic.py#L294

Added line #L294 was not covered by tests

n_outputs = len(node.outputs)

if n_outputs > 1:
Expand Down