Skip to content

Conversation

@ricardoV94
Copy link
Member

Related to #7926
Related to PyMC V6 roadmap

Relies on next PyTensor release

PyMC will now be tested on both C and Numba backends, antecipating the switch to Numba as the default backend from PyTensor

@ricardoV94 ricardoV94 added this to the v6 milestone Dec 14, 2025
@ricardoV94 ricardoV94 changed the title Run whole suite with numba linker Run whole suite with C and Numba linkers Dec 14, 2025
@ricardoV94 ricardoV94 force-pushed the pytensor_numba branch 2 times, most recently from 2e3466e to 82ee1d9 Compare December 21, 2025 13:06
@codecov
Copy link

codecov bot commented Dec 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.45%. Comparing base (056e80c) to head (cd3983e).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7993   +/-   ##
=======================================
  Coverage   91.44%   91.45%           
=======================================
  Files         116      116           
  Lines       19002    19025   +23     
=======================================
+ Hits        17377    17399   +22     
- Misses       1625     1626    +1     
Files with missing lines Coverage Δ
pymc/dims/distributions/scalar.py 95.08% <100.00%> (+0.21%) ⬆️
pymc/distributions/continuous.py 98.26% <100.00%> (+0.01%) ⬆️
pymc/testing.py 90.64% <100.00%> (+0.09%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94
Copy link
Member Author

Seems like only one meaningful test failure left: https://github.com/pymc-devs/pymc/actions/runs/20662736046/job/59344923930?pr=7993#step:5:1066

Less noisy when doing interactive debugging
Remove useless os paramerizations and update codecov name
@ricardoV94 ricardoV94 force-pushed the pytensor_numba branch 2 times, most recently from 4d98fe3 to c88bc7a Compare January 5, 2026 12:47
Most warnings are filtered by PyTensor but pytest reenables them
@ricardoV94 ricardoV94 marked this pull request as ready for review January 5, 2026 13:46
@ricardoV94
Copy link
Member Author

ricardoV94 commented Jan 5, 2026

Tests are passing, CI didn't blow up, although it's a tad slower. This is the slowest one: https://github.com/pymc-devs/pymc/actions/runs/20717356014/job/59471703297?pr=7993#step:5:994

We may want to tweak the first two which take 2m (8% of the whole CI time)

92.50s call     tests/logprob/test_transform_value.py::test_weakref_leak
35.06s call     tests/logprob/test_transform_value.py::test_default_value_transform_logprob[pt_dist17-dist_params17-<lambda>-size17]

And these, as the CI had a large delta from the one in CVM: https://github.com/pymc-devs/pymc/actions/runs/20717356014/job/59471703228?pr=7993#step:5:1251

57.98s call     tests/distributions/test_multivariate.py::TestLKJCorr::test_distribution
32.25s call     tests/distributions/test_continuous.py::TestMatchesScipy::test_interpolated
26.81s call     tests/distributions/test_multivariate.py::TestMatchesScipy::test_mvnormal_indef
22.84s call     tests/distributions/test_multivariate.py::TestLKJCholeskyCov::test_distribution
22.21s call     tests/distributions/test_multivariate.py::TestLKJCholeskCov::test_dist
21.85s call     tests/distributions/test_continuous.py::TestInterpolated::test_distribution

Finally, this is a tad too much for a progress_bar

34.92s call     tests/test_progress_bar.py::test_progressbar_nested_compoundtest

Copying comment to #7686

@jessegrabowski
Copy link
Member

The performance of the linalg distributions (lkj, mvn) should improve a bit after we cut a release with the numba caching

@ricardoV94
Copy link
Member Author

ricardoV94 commented Jan 5, 2026

The performance of the linalg distributions (lkj, mvn) should improve a bit after we cut a release with the numba caching

Yup. I thought we already released it, so that's good news. Also pymc-devs/pytensor#1821 as those tend up to show in our pdf/cdfs

expected_rv_op_params = {
"mu": np.array([1.0, 2.0]),
"cov": quaddist_matrix(chol=pymc_dist_params["chol"]).eval(),
"cov": quaddist_matrix(chol=pymc_dist_params["chol"]).eval(mode="FAST_COMPILE"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this mode need to be specified? Does it work if we're in numba mode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does, but bothered me during interactive debugging, because we end up triggering the slow-compilation codebase for a simple constant-fold


def check_pymc_draws_match_reference_not_numba(self):
# This calls `check_pymc_draws_match_reference` but only if the default linker is NOT numba.
# It's used when the draws aren't expected to match in that backend.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't draws expected to match in numba? Some rng state issue?

Copy link
Member Author

@ricardoV94 ricardoV94 Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an issue, we just don't copy the exact PRNG algorithm that scipy/numpy does for these specific distributions. If JAX were the default backend we wouldn't expect for them to ever match.

This is an exact test, not a distributional one

assert "This does not respect one of the following constraints: sigma > 0" in out
else: # "random"
if isinstance(get_default_mode().linker, NumbaLinker):
# Numba doesn't raise for negative sigma in NormalRV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, didn't want to block on that decision though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ricardoV94 ricardoV94 merged commit bbcb81d into pymc-devs:main Jan 5, 2026
42 checks passed
@ricardoV94 ricardoV94 deleted the pytensor_numba branch January 5, 2026 15:28
@ricardoV94 ricardoV94 added the no releasenotes Skipped in automatic release notes generation label Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no releasenotes Skipped in automatic release notes generation numba pytensor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants