Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
ca35083
Remove dead frame-walking debug print in Validator.validate
ricardoV94 Jun 16, 2026
f679d60
Don't mutate global config.openmp from OpenMPOp codegen
ricardoV94 Jun 16, 2026
5cd94a5
Remove dead, broken profile-sum-at-exit block
ricardoV94 Jun 16, 2026
9846ee8
Remove GPU-backend leftovers from scan
ricardoV94 Jun 16, 2026
e00b1b7
Remove dead GPU-era Type.filter_inplace hook
ricardoV94 Jun 16, 2026
7379854
Remove dead gcc_llvm detector and Python-2 'SO' suffix fallback
ricardoV94 Jun 16, 2026
5baeb46
Remove dead scalar and printing helpers
ricardoV94 Jun 22, 2026
cc9621e
Remove dead config flags warn__ignore_bug_before and metaopt__verbose
ricardoV94 Jun 22, 2026
4451c41
Remove deprecated end/steps arguments from linspace/geomspace/logspace
ricardoV94 Jun 22, 2026
dbb45c9
Fix CachedEquilibrimDB cache never invalidating on register
ricardoV94 Jun 22, 2026
6e08896
Fix Elemwise.perform falling through with >32 operands
ricardoV94 Jun 22, 2026
95f0b50
Fix linker=vm returning a tuple instead of a Mode
ricardoV94 Jun 22, 2026
1f2255a
Fix misspelled DisconnectedType.filter_variable override
ricardoV94 Jun 22, 2026
c2bd825
Fix OpToRewriterTracker double-registering OpPatterns
ricardoV94 Jun 22, 2026
6632db9
Fix print_global_stats writing to the filename string
ricardoV94 Jun 22, 2026
d30d6ba
Remove is_same_graph in favor of equal_computations
ricardoV94 Jun 25, 2026
5dcf3b6
Remove dead full_tree debug param from perform_sigm_times_exp
ricardoV94 Jun 25, 2026
03d34b2
Collapse three near-identical Unique lift rewriters into one
ricardoV94 Jun 25, 2026
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ jobs:
run: |
if [[ $DEFAULT_MODE == "FAST_COMPILE" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,mode=FAST_COMPILE; fi
if [[ $DEFAULT_MODE == "CVM" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,linker=cvm; fi
export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
python -m pytest -r A --verbose --runslow --durations=50 --cov=pytensor/ --cov-report=xml:coverage/coverage-${MATRIX_ID}.xml --no-cov-on-fail $PART --benchmark-skip
env:
MATRIX_ID: ${{ steps.matrix-id.outputs.id }}
Expand Down Expand Up @@ -248,7 +248,7 @@ jobs:
- name: Run benchmarks
shell: micromamba-shell {0}
run: |
export PYTENSOR_FLAGS=warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
export PYTENSOR_FLAGS=on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
python -m pytest --runslow --benchmark-only --benchmark-json output.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1.22.1
Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def pytest_sessionstart(session):
os.environ["PYTENSOR_FLAGS"] = ",".join(
[
os.environ.setdefault("PYTENSOR_FLAGS", ""),
"warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,cmodule__warn_no_version=True",
"on_opt_error=raise,on_shape_error=raise,cmodule__warn_no_version=True",
]
)
os.environ["NUMBA_BOUNDSCHECK"] = "1"
Expand Down
4 changes: 0 additions & 4 deletions doc/internal/how_to_release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ Update the version number

Update the year in the ``PyTensor/LICENSE.txt`` file too, if necessary.

Update the code and the documentation for the pytensor flags
``warn__ignore_bug_before`` to accept the new version. You must modify the
file ``pytensor/configdefaults.py`` and ``doc/library/config.txt``.

Tag the release
===============

Expand Down
33 changes: 0 additions & 33 deletions doc/library/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -405,31 +405,6 @@ import ``pytensor`` and print the config variable, as in:
raise the exception (i.e. ``'raise'``).


.. attribute:: config.warn__ignore_bug_before

String value: ``'None'``, ``'all'``, ``'0.3'``, ``'0.4'``, ``'0.4.1'``,
``'0.5'``, ``'0.6'``, ``'0.7'``, ``'0.8'``, ``'0.8.1'``, ``'0.8.2'``,
``'0.9'``, ``'0.10'``, ``'1.0'``, ``'1.0.1'``, ``'1.0.2'``, ``'1.0.3'``,
``'1.0.4'``,``'1.0.5'``

Default: ``'0.9'``

When we an PyTensor bug that generated a bad result is fixed, we also make
PyTensor raise a warning when it encounters the same circumstances again. This
helps users determine whether or not said bug has affected past runs, since
one only needs to perform the same runs again with the new version, and one
does not have to understand the PyTensor internals that triggered the bug.

This flag lets users ignore warnings about old bugs that were
fixed before their first checkout of PyTensor.
You can set its value to the first version of PyTensor
that you used (probably 0.3 or higher)

``'None'`` means that all warnings will be displayed.
``'all'`` means all warnings will be ignored.

This flag's value cannot be modified during program execution.

.. attribute:: base_compiledir

Default: On Windows: ``$LOCALAPPDATA\\PyTensor`` if ``$LOCALAPPDATA`` is defined,
Expand Down Expand Up @@ -734,11 +709,3 @@ import ``pytensor`` and print the config variable, as in:
The number of traceback stack levels to keep for variables during PyTensor
compilation. When this value is greater than zero, it will make PyTensor keep
internal stack traces.

.. attribute:: config.metaopt__verbose

Int value, default: 0

The verbosity level of the meta-rewriter: ``0`` for silent, ``1`` to only
warn when PyTensor cannot meta-rewrite an :class:`Op`, ``2`` for full output (e.g.
timings and the rewrites selected).
60 changes: 1 addition & 59 deletions pytensor/compile/debug/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#

import atexit
import copy
import logging
import operator
import sys
Expand Down Expand Up @@ -54,8 +53,6 @@ def extended_open(filename, mode="r"):
def _atexit_print_fn():
"""Print `ProfileStat` objects in `_atexit_print_list` to `_atexit_print_file`."""
if config.profile:
to_sum = []

if config.profiling__destination == "stderr":
destination_file = "<stderr>"
elif config.profiling__destination == "stdout":
Expand All @@ -78,64 +75,9 @@ def _atexit_print_fn():
n_ops_to_print=config.profiling__n_ops,
n_apply_to_print=config.profiling__n_apply,
)

if ps.show_sum:
to_sum.append(ps)
else:
# TODO print the name if there is one!
print("Skipping empty Profile") # noqa: T201
if len(to_sum) > 1:
# Make a global profile
cum = copy.copy(to_sum[0])
msg = f"Sum of all({len(to_sum)}) printed profiles at exit."
cum.message = msg
for ps in to_sum[1:]:
for attr in [
"compile_time",
"fct_call_time",
"fct_callcount",
"vm_call_time",
"rewriter_time",
"linker_time",
"validate_time",
"import_time",
"linker_node_make_thunks",
]:
setattr(cum, attr, getattr(cum, attr) + getattr(ps, attr))

# merge dictionary
for attr in [
"apply_time",
"apply_callcount",
"apply_cimpl",
"variable_shape",
"variable_strides",
"variable_offset",
"linker_make_thunk_time",
]:
cum_attr = getattr(cum, attr)
for key, val in getattr(ps, attr.items()):
assert key not in cum_attr, (key, cum_attr)
cum_attr[key] = val

if cum.rewriter_profile and ps.rewriter_profile:
try:
merge = cum.rewriter_profile[0].merge_profile(
cum.rewriter_profile[1], ps.rewriter_profile[1]
)
assert len(merge) == len(cum.rewriter_profile[1])
cum.rewriter_profile = (cum.rewriter_profile[0], merge)
except Exception as e:
print(e) # noqa: T201
cum.rewriter_profile = None
else:
cum.rewriter_profile = None

cum.summary(
file=f,
n_ops_to_print=config.profiling__n_ops,
n_apply_to_print=config.profiling__n_apply,
)

if config.print_global_stats:
print_global_stats()
Expand All @@ -159,7 +101,7 @@ def print_global_stats():
destination_file = config.profiling__destination

with extended_open(destination_file, mode="w") as f:
print("=" * 50, file=destination_file)
print("=" * 50, file=f)
print(
(
"Global stats: ",
Expand Down
2 changes: 1 addition & 1 deletion pytensor/compile/mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def clone(self, link_kwargs=None, optimizer="", **kwargs):

C = Mode("c", "fast_run")
CVM = Mode("cvm", "fast_run")
VM = (Mode("vm", "fast_run"),)
VM = Mode("vm", "fast_run")

NUMBA = Mode(
NumbaLinker(),
Expand Down
61 changes: 0 additions & 61 deletions pytensor/configdefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,6 @@ def _filter_mode(val):
)


def _split_version(version):
"""
Take version as a dot-separated string, return a tuple of int
"""
return tuple(int(i) for i in version.split("."))


def _warn_default(version):
"""
Return True iff we should warn about bugs fixed after a given version.
"""
if config.warn__ignore_bug_before == "None":
return True
if config.warn__ignore_bug_before == "all":
return False
if _split_version(config.warn__ignore_bug_before) >= _split_version(version):
return False
return True


def _is_valid_check_preallocated_output_param(param):
if not isinstance(param, str):
return False
Expand Down Expand Up @@ -591,47 +571,6 @@ def add_traceback_configvars():


def add_error_and_warning_configvars():
###
# To disable some warning about old bug that are fixed now.
###
config.add(
"warn__ignore_bug_before",
(
"If 'None', we warn about all PyTensor bugs found by default. "
"If 'all', we don't warn about PyTensor bugs found by default. "
"If a version, we print only the warnings relative to PyTensor "
"bugs found after that version. "
"Warning for specific bugs can be configured with specific "
"[warn] flags."
),
EnumStr(
"0.9",
[
"None",
"all",
"0.3",
"0.4",
"0.4.1",
"0.5",
"0.6",
"0.7",
"0.8",
"0.8.1",
"0.8.2",
"0.9",
"0.10",
"1.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
],
mutable=False,
),
in_c_key=False,
)

# Note to developers:
# Generally your exceptions should use an apply node's __str__
# method when exception_verbosity == 'low'. When exception_verbosity
Expand Down
3 changes: 0 additions & 3 deletions pytensor/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class PyTensorConfigParser:
traceback__limit: int
traceback__compile_limit: int
# add_error_and_warning_configvars
warn__ignore_bug_before: int
exception_verbosity: str
# add_testvalue_and_checking_configvars
check_input: bool
Expand Down Expand Up @@ -138,8 +137,6 @@ class PyTensorConfigParser:
optdb__max_use_ratio: float
cycle_detection: str
check_stack_trace: str
# add_metaopt_configvars
metaopt__verbose: int
# add_vm_configvars
profile: bool
profile_optimizer: bool
Expand Down
2 changes: 1 addition & 1 deletion pytensor/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def filter(self, data, strict=False, allow_downcast=None):
" a symbolic placeholder."
)

def fiter_variable(self, other):
def filter_variable(self, other):
raise AssertionError(
"If you're assigning to a DisconnectedType you're"
" doing something wrong. It should only be used as"
Expand Down
27 changes: 1 addition & 26 deletions pytensor/graph/features.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import inspect
import sys
import time
import warnings
Expand Down Expand Up @@ -693,32 +692,8 @@ def on_attach(self, fgraph):
)

def validate(self, fgraph):
"""
If the caller is replace_all_validate, just raise the
exception. replace_all_validate will print out the
verbose output. Or it has to be done here before raise.
"""
t0 = time.perf_counter()
try:
ret = fgraph.execute_callbacks("on_validate")
except Exception as e:
cf = inspect.currentframe()
uf = cf.f_back
uf_info = inspect.getframeinfo(uf)

# If the caller is replace_all_validate, just raise the
# exception. replace_all_validate will print out the
# verbose output.
# Or it has to be done here before raise.
if uf_info.function == "replace_all_validate":
raise
else:
verbose = uf.f_locals.get("verbose", False)
if verbose:
r = uf.f_locals.get("r", "")
reason = uf_info.function
print(f"validate failed on node {r}.\n Reason: {reason}, {e}") # noqa: T201
raise
ret = fgraph.execute_callbacks("on_validate")
t1 = time.perf_counter()
if fgraph.profile:
fgraph.profile.validate_time += t1 - t0
Expand Down
2 changes: 1 addition & 1 deletion pytensor/graph/rewriting/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ def add_tracker(self, rw: NodeRewriter):
else:
# An OpPattern without parameters behaves like a regular tracked_type
self.tracked_types[c.op_type].append(rw)
if isinstance(c, type):
elif isinstance(c, type):
self.tracked_types[c].append(rw)
else:
self.tracked_instances[c].append(rw)
Expand Down
Loading
Loading