Skip to content

Attempted fix for eventual Vulkan errors. - #3450

Closed
ScottTodd wants to merge 2 commits into
iree-org:mainfrom
ScottTodd:python-vk
Closed

ScottTodd wants to merge 2 commits into
iree-org:mainfrom
ScottTodd:python-vk

Conversation

@ScottTodd

Copy link
Copy Markdown
Member

Fixes #3381 (or at least appears to for me)

return self->Unpack(absl::MakeConstSpan(self->raw_config().results),
f_results);
},
py::keep_alive<0, 1>());

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Some test failures:

ERROR: test_add_scalar (__main__.VmTest)
VmTest.test_add_scalar
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmpfs/src/github/iree/bindings/python/pyiree/rt/vm_test.py", line 138, in test_add_scalar
    result = abi.unpack_results(allocated_results)
RuntimeError: Could not allocate weak reference!

----------------------------------------------------------------------
Ran 9 tests in 2.937s

FAILED (errors=1)

Logs: https://source.cloud.google.com/results/invocations/4cb4b8be-635f-4928-a098-567ee13c5cb4/targets/iree%2Fgcp_ubuntu%2Fcmake%2Flinux%2Fx86-swiftshader%2Fpresubmit/log

@ScottTodd

Copy link
Copy Markdown
Member Author

This didn't work, and the pyiree code it affected is obsolete now.

@ScottTodd ScottTodd closed this Dec 9, 2020
@ScottTodd
ScottTodd deleted the python-vk branch December 9, 2020 20:54
stellaraccident added a commit to stellaraccident/iree that referenced this pull request Feb 5, 2021
* Fixes iree-org#3381
* While many programs didn't suffer from this, any time references to the array memory escape to the generational collector, a subsequent collection has a high likelihood of freeing the device prior to the buffer allocated against it.
* JAX internally seems to have a heuristic that caches a bunch of things and manually invokes the generational gc.
* There were many other things I would like to improve about this code but I held off and just did a targeted bug fix.
* The prior attempt (iree-org#3450) failed because with multiple results, it would have tried to get a weak reference to a tuple, which is not permitted. This more manual intervention stitches the keep-alive onto the actual objects that need it.
stellaraccident added a commit to stellaraccident/iree that referenced this pull request Feb 5, 2021
* Fixes iree-org#3381
* While many programs didn't suffer from this, any time references to the array memory escape to the generational collector, a subsequent collection has a high likelihood of freeing the device prior to the buffer allocated against it.
* JAX internally seems to have a heuristic that caches a bunch of things and manually invokes the generational gc.
* There were many other things I would like to improve about this code but I held off and just did a targeted bug fix.
* The prior attempt (iree-org#3450) failed because with multiple results, it would have tried to get a weak reference to a tuple, which is not permitted. This more manual intervention stitches the keep-alive onto the actual objects that need it.
stellaraccident added a commit to stellaraccident/iree that referenced this pull request Feb 5, 2021
* Fixes iree-org#3381
* While many programs didn't suffer from this, any time references to the array memory escape to the generational collector, a subsequent collection has a high likelihood of freeing the device prior to the buffer allocated against it.
* JAX internally seems to have a heuristic that caches a bunch of things and manually invokes the generational gc.
* There were many other things I would like to improve about this code but I held off and just did a targeted bug fix.
* The prior attempt (iree-org#3450) failed because with multiple results, it would have tried to get a weak reference to a tuple, which is not permitted. This more manual intervention stitches the keep-alive onto the actual objects that need it.
rsuderman pushed a commit to rsuderman/iree that referenced this pull request Feb 9, 2021
* Fixes iree-org#3381
* While many programs didn't suffer from this, any time references to the array memory escape to the generational collector, a subsequent collection has a high likelihood of freeing the device prior to the buffer allocated against it.
* JAX internally seems to have a heuristic that caches a bunch of things and manually invokes the generational gc.
* There were many other things I would like to improve about this code but I held off and just did a targeted bug fix.
* The prior attempt (iree-org#3450) failed because with multiple results, it would have tried to get a weak reference to a tuple, which is not permitted. This more manual intervention stitches the keep-alive onto the actual objects that need it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vulkan memory leak with pyiree

2 participants