-
Notifications
You must be signed in to change notification settings - Fork 18
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
Switch to nanobind #107
Switch to nanobind #107
Conversation
ce0596b
to
ac0a047
Compare
A potential reason may be https://nanobind.readthedocs.io/en/latest/faq.html#how-can-i-preserve-the-const-ness-of-values-in-bindings Edit: |
The current version compiles but crashes early during execution with: $ python examples/demo.py
Traceback (most recent call last):
File "/Users/mdiener/Work/emirge/islpy/examples/demo.py", line 6, in <module>
.add_constraint(isl.Constraint.ineq_from_names(space, {1: -1, "x": 1}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mdiener/Work/emirge/miniforge3/envs/ceesd/lib/python3.11/site-packages/islpy/__init__.py", line 589, in ineq_from_names
return c.set_coefficients_by_name(coefficients)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mdiener/Work/emirge/miniforge3/envs/ceesd/lib/python3.11/site-packages/islpy/__init__.py", line 486, in obj_set_coefficients_by_name
name_to_dim = self.get_space().get_var_dict()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mdiener/Work/emirge/miniforge3/envs/ceesd/lib/python3.11/site-packages/islpy/__init__.py", line 929, in wrapper
return basic_method(basic_instance, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mdiener/Work/emirge/miniforge3/envs/ceesd/lib/python3.11/site-packages/islpy/__init__.py", line 403, in space_get_var_dict
name = self.get_dim_name(tp, i)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mdiener/Work/emirge/miniforge3/envs/ceesd/lib/python3.11/site-packages/islpy/__init__.py", line 929, in wrapper
return basic_method(basic_instance, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: nanobind::cast_error
nanobind: leaked 74 instances!
nanobind: leaked 84 types!
- leaked type "islpy._isl.SetList"
- leaked type "islpy._isl.AstNode"
- leaked type "islpy._isl.MultiAff"
- leaked type "islpy._isl.AccessInfo"
- leaked type "islpy._isl.ScheduleNode"
- leaked type "islpy._isl.MapList"
- leaked type "islpy._isl.UnionPwMultiAffList"
- leaked type "islpy._isl.ast_loop_type"
- leaked type "islpy._isl.QPolynomial"
- leaked type "islpy._isl.PwMultiAff"
- leaked type "islpy._isl.QPolynomialFold"
- ... skipped remainder
nanobind: leaked 3151 functions!
- leaked function "to_str"
- leaked function "flatten"
- leaked function "union"
- leaked function "sub"
- leaked function "empty_space"
- leaked function "get_list"
- leaked function "set_max_operations"
- leaked function "is_bijective"
- leaked function "_is_valid"
- leaked function "from_pw_aff"
- leaked function "remove_dims"
- ... skipped remainder
nanobind: this is likely caused by a reference counting issue in the binding code. Edit: Crash fixed by 4b8c175. |
I've traced the crash back to
Edit: Crash fixed by 4b8c175. |
5208178
to
a9d7674
Compare
This seems to generally work and Hmm. |
5aac91b
to
9ca1641
Compare
Co-authored-by: Andreas Kloeckner <[email protected]>
Thank you @inducer! Here are a few performance numbers on my M1 (all with isl-imath32):
|
To-do: