Skip to content

Remove uses of numba_basic.global_numba_func #1535

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

Merged
merged 6 commits into from
Jul 14, 2025

Conversation

PabloRoque
Copy link
Contributor

@PabloRoque PabloRoque commented Jul 13, 2025

Description

Remove all instances if numba_basic.global_numba_func in the codebase as indicated in #1442

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

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

@PabloRoque PabloRoque changed the title Remove uses if numba_basic.global_numba_func Remove uses of numba_basic.global_numba_func Jul 13, 2025
Copy link

codecov bot commented Jul 13, 2025

Codecov Report

Attention: Patch coverage is 93.10345% with 4 lines in your changes missing coverage. Please review.

Project coverage is 81.86%. Comparing base (7efd1c5) to head (9c42383).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pytensor/link/numba/dispatch/basic.py 50.00% 4 Missing ⚠️

❌ Your patch status has failed because the patch coverage (93.10%) 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    #1535      +/-   ##
==========================================
- Coverage   81.86%   81.86%   -0.01%     
==========================================
  Files         230      230              
  Lines       52508    52508              
  Branches     9339     9339              
==========================================
- Hits        42987    42984       -3     
- Misses       7089     7092       +3     
  Partials     2432     2432              
Files with missing lines Coverage Δ
pytensor/link/numba/dispatch/scalar.py 90.28% <100.00%> (ø)
pytensor/link/numba/dispatch/basic.py 78.28% <50.00%> (-0.81%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@PabloRoque PabloRoque marked this pull request as ready for review July 13, 2025 12:10
outputs = output_fn(*inputs)

cm = contextlib.suppress() if exc is None else pytest.raises(exc)
cm = contextlib.suppress()
Copy link
Member

Choose a reason for hiding this comment

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

just remove cm altogether

Copy link
Member

@ricardoV94 ricardoV94 Jul 13, 2025

Choose a reason for hiding this comment

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

And please put these test changes in a separate commit, or open a separate PR since they are not related to the refactor, and shouldn't be mixed in the git history

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

Looks good, since you decided to cleanup unrelated test, there's an extra cleanup you can do

@PabloRoque PabloRoque force-pushed the remove-global-numba-func branch from b34f817 to dcd2576 Compare July 13, 2025 14:48
@PabloRoque PabloRoque mentioned this pull request Jul 13, 2025
11 tasks
@PabloRoque
Copy link
Contributor Author

Moved the changes to test_Elemwise to #1536.

Comment on lines 178 to 181
def py_global_numba_func(func):
if hasattr(func, "py_func"):
return func.py_func
return func
Copy link
Member

Choose a reason for hiding this comment

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

These changes seem unrelated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rolled back these changes.

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

small note, otherwise looks good

@@ -25,6 +25,7 @@
from pytensor.graph.fg import FunctionGraph
from pytensor.graph.type import Type
from pytensor.ifelse import IfElse
from pytensor.link.numba.dispatch import basic as numba_basic
Copy link
Member

Choose a reason for hiding this comment

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

basic is the file where we are?

@numba_funcify.register(MakeSlice)
def numba_funcify_MakeSlice(op, **kwargs):
return global_numba_func(makeslice)
@numba_basic.numba_njit
Copy link
Member

Choose a reason for hiding this comment

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

numba_njit is defined in this module

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, cutting and pasting from the other file one without reading 😓



@numba_funcify.register(Shape)
def numba_funcify_Shape(op, **kwargs):
return global_numba_func(shape)
@numba_basic.numba_njit
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, same above

@ricardoV94 ricardoV94 merged commit b4522d2 into pymc-devs:main Jul 14, 2025
72 of 73 checks passed
@ricardoV94
Copy link
Member

Thanks @PabloRoque

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.

Remove uses of numba_basic.global_numba_func(erfc)
2 participants