Closed ricardoV94 closed 2 years ago
Quick Google suggests it may be a reference count issue: https://stackoverflow.com/a/64960890
What's the python -c "import aesara; print(aesara.config)
output?
What's the
python -c "import aesara; print(aesara.config)
output?
Any ideas on a path forward here?
Any ideas on a path forward here?
Someone with a good Windows development setup that can reproduce the issue needs to start debugging it. My first assumption is that this is just another reference count problem.
Hopefully, there's just a bug in the new implementation and one can find it by manually tracking the reference counts (e.g. print them all throughout the DimShuffle
C code and look for cases where the count is 0 and the variable is still being actively used or passed off to be used). The fix would then be the addition of strategically placed Py_INCREF
s and/or Py_DECREF
s.
Worst case, the issue could be caused by a CPython version/implementation discrepancy and the above might fix things for Windows but break things in Linux (or introduce a memory leak).
Regardless, someone needs to do some simple debugging (and not forget to aesara-cache clear
between changes).
The issue seems to be the use of PyDimMem_FREE
here. Changing it to free(reshape_shape.ptr)
or free(_reshape_shape)
fixes the issue.
:+1: how painful was that to find?
+1 how painful was that to find?
It took literally five minutes to find it after about an hour of building a Windows VM, setting up a dev environment, finding out how nearly impossible it is to get gdb
working with a Conda m2w64-toolchain
setup, etc., etc.
This was first seen in https://github.com/pymc-devs/pymc/pull/5279
The following tests are failing on my Windows machine:
test_elemwise.py::TestDimShuffle::test_infer_shape
test_elemwise.py::TestDimShuffle::test_too_big_rank
test_elemwise.py::TestDimShuffle::test_c_views
The first two tests which precede #701 pass before the relevant commit: https://github.com/aesara-devs/aesara/commit/e593b0ac57a0d56d4f6ffdd08d52c3be78ebf961 and fail after.
For sanity check, all tests in
test_elemwise.py::TestBroadcast
work fine in main.Traceback
When running
test_elemwise.py::TestDimShuffle::test_c_views
:Versions and main components
python -c "import aesara; print(aesara.config)"
)And then removed aesara with
conda remove --force aesara
to use the local branch