-
Notifications
You must be signed in to change notification settings - Fork 756
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
[#1381] Change cuMemFreeAsync to cuMemFree in vmaf_cuda_picture_free() #1382
base: master
Are you sure you want to change the base?
[#1381] Change cuMemFreeAsync to cuMemFree in vmaf_cuda_picture_free() #1382
Conversation
Tagging @gedoensmax |
When does this crash occur ? During processing or only after processing for a while ? When using CUDA the internally preallocated pictures should be used in FFmpeg so that this free should only be called after processing all the pictures when closing the context. |
Dear @gedoensmax
The VMAF score is output correctly, but an assertion occurs when ffmpeg exits. Reproducing the issue is very easy. The key point for reproducing the issue is setting the virtual memory limit using ulimit -v.
I followed your guide and set the environment variables as shown below, but the same issue continues to occur.
|
Ok so when using the internal memory pool correctly it should not have any performance impact to move to the synchronous version of this API. In case this is not possible though and pictures are allocated and free'd dynamically it will introduce a CUDA synchronization. |
We were limiting the virtual memory before running the ffmpeg process due to an unresolved memory leak issue in ffmpeg.
We understand what you mean. |
As you are saying this is not an easy questionand i think if your change is fixing the problem you shall use it. Do you need the change to be in main branch though ? Or maybe you can expose the change to synchronous free through an option ? |
As you mentioned, we can apply this fix only in our branch and it does not need to be applied to the main branch. |
This PR is a fix to #1381
Description
We have identified that when using the libvmaf_cuda(vmaf-3.0.0) filter with ffmpeg in a constrained virtual memory environment, an assertion failure occurs in vmaf_cuda_picture_free() when ffmpeg terminates.
You can easily reproduce the issue by running the ffmpeg command with the libvmaf_cuda filter along with
ulimit -v 16777216
. (16777216 represents 16GB, which is a sufficient size for virtual memory.)According to the API documentation, cuMemFreeAsync() does not return CUDA_ERROR_OUT_OF_MEMORY. However, in this abnormal situation, it is returning CUDA_ERROR_OUT_OF_MEMORY.
We have confirmed that using the synchronous memory free API, cuMemFree(), resolves the issue. We propose modifying the code to use cuMemFree() for freeing memory until the underlying cause of the issue with the CUDA asynchronous API is resolved.