Open isuruf opened 1 year ago
Not sure about this, specifically because I'm hesitant to have PyOpenCL pick up a C-level API (which is more complexity that needs managing).
I think you can do the same just from Python, and the extra overhead should not really matter given that memory allocation is high-cost anyhow.
The issue is that allocation might happen in C side, for eg: in VkFFT where phase vectors are allocated and there's no way to plug in a custom allocator.
But wouldn't a call to a presumptive PyOpenCL C API stick out like sore thumb in such a setting just as much as a bunch of Python C API "stuff" to call the Python side?
Taking the example of pyvkfft, I was thinking of changing the line https://github.com/vincefn/pyvkfft/blob/5b51a7bcb0d93581c5ea8dcf7edbe77d1b191f2f/src/vkfft_opencl.cpp#L15 from
#include "vkFFT.h"
to
#include <pyopencl-allocate.h>
#include "vkFFT.h"
and that should work without any other changes.
Is your feature request related to a problem? Please describe. When using pyvkfft, vkfft calls clCreateBuffer which fails sometimes because it doesn't run the garbage collector.
Describe the solution you'd like If we could have a header like below, we can include that in pyvkfft.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.