Skip to content

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Oct 9, 2025

Spinoff some cleanup from #1637

There was a lot of cruft in dispatch/basic.py, not to be confused with dispatch/tensor_basic.py, including a duplicated dispatch of Solve?

This PR moves things to better files, removes unused functions, and makes other obsolete.

It removes the helper to_scalar, that made numba dispatchers more permissive than they need to be?
This might have been originally here due to numba/numba#10266 but the work-around should happen at the relevant Elemwise op level, not in functions that accept 0d arrays. Otherwise we end up chasing this everywhere (and probably missing it in some places)


📚 Documentation preview 📚: https://pytensor--1648.org.readthedocs.build/en/1648/

@ricardoV94 ricardoV94 force-pushed the cleanup_numba_dispatches branch 3 times, most recently from ec3b6be to 7872d99 Compare October 9, 2025 16:17
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 90.70796% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.63%. Comparing base (602eb04) to head (c594eb4).

Files with missing lines Patch % Lines
pytensor/link/numba/dispatch/basic.py 77.77% 7 Missing and 3 partials ⚠️
pytensor/link/numba/dispatch/subtensor.py 82.92% 5 Missing and 2 partials ⚠️
pytensor/link/numba/dispatch/elemwise.py 90.47% 3 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (90.70%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1648      +/-   ##
==========================================
+ Coverage   81.58%   81.63%   +0.05%     
==========================================
  Files         240      242       +2     
  Lines       53593    53564      -29     
  Branches     9454     9451       -3     
==========================================
+ Hits        43722    43727       +5     
+ Misses       7395     7360      -35     
- Partials     2476     2477       +1     
Files with missing lines Coverage Δ
pytensor/configdefaults.py 73.54% <ø> (-0.09%) ⬇️
pytensor/configparser.py 92.55% <ø> (-0.03%) ⬇️
pytensor/link/numba/dispatch/__init__.py 100.00% <100.00%> (ø)
pytensor/link/numba/dispatch/extra_ops.py 95.51% <100.00%> (+0.02%) ⬆️
pytensor/link/numba/dispatch/scalar.py 87.64% <100.00%> (-2.64%) ⬇️
pytensor/link/numba/dispatch/scan.py 96.02% <ø> (-0.03%) ⬇️
pytensor/link/numba/dispatch/shape.py 100.00% <100.00%> (ø)
pytensor/link/numba/dispatch/sort.py 100.00% <100.00%> (ø)
pytensor/link/numba/dispatch/tensor_basic.py 88.33% <100.00%> (+0.94%) ⬆️
pytensor/link/numba/dispatch/elemwise.py 94.28% <90.47%> (-0.54%) ⬇️
... and 2 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Armavica
Copy link
Member

Armavica commented Oct 9, 2025

Thanks, I will start reviewing this PR this weekend

Copy link
Member

@Armavica Armavica left a comment

Choose a reason for hiding this comment

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

A few questions otherwise that looks good to me!

return lambda x, y: False


enable_slice_boxing
Copy link
Member

Choose a reason for hiding this comment

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

I think there is a function call missing?

Copy link
Member Author

Choose a reason for hiding this comment

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

that could mean we actually don't need (or are not testing) this functionality... Should show up in runtime slices

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a test, and actually fixed it a bit (last commit). This can all be removed after #541 is fixed, as we won't need to represent slices symbolically anymore

@ricardoV94 ricardoV94 force-pushed the cleanup_numba_dispatches branch from 7872d99 to 3521a40 Compare October 14, 2025 12:54
@ricardoV94 ricardoV94 force-pushed the cleanup_numba_dispatches branch from 3521a40 to c594eb4 Compare October 14, 2025 12:54
@ricardoV94 ricardoV94 requested a review from Armavica October 14, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants