cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

yom
Journeyman III

OpenCL memory buffer and image less than 64 Mb not releasing?

Hi everybody,

I'm encountering some very strange behaviours with OpenCL and I need some explanations from the AMD community.

Let describe my problem:

%-----------------------------------------------------------------------------------------------------------------

1) Configuration:

- AMD APP SDK 2.9-1 with Catalyst driver 14.4 (I also tried 14.7 and 14.9) as described here

- GPU Sapphire Radeon 270X (4 Gb)

- CPU Intel i5 2400

- 16 Gb RAM

- Use of OCL C++ bindings

- Windows 7 Ultimate

- Visual Studio Pro 2012

My basic problem is the following, I create a buffer/image, push data on GPU with enqueueWriteBuffer/enqueueWriteImage and then clean memory.

I monitor my GPU with GPU-Z or Process Explorer in order to control my GPU memory in live.

So if my buffer/image size is greater or equal than 64 Mb, everything is ok but if my buffer/image size is less than this value, I don't see any release of the GPU memory...

%-----------------------------------------------------------------------------------------------------------------

2) Configuration:

- AMD APP SDK 3.0 Beta with Catalyst driver Omega 14.12 (I also tried 15.7) as described here

- GPU Sapphire Radeon 270X (4 Gb)

- CPU Intel i5 2400

- 16 Gb RAM

- Use of OCL C++ bindings

- Windows 7 Ultimate

- Visual Studio Pro 2012

Once again, I create a buffer/image, push data on GPU with enqueueWriteBuffer/enqueueWriteImage and then clean memory.

I monitor my GPU with GPU-Z or Process Explorer in order to control my GPU memory in live.

So if my buffer/image size is greater or equal than 512 Mb, everything is ok but if my buffer/image size is less than this value, I don't see any release of the GPU memory...

%-----------------------------------------------------------------------------------------------------------------

My conclusion is that it's not a memory leak since if I iterate the process, there is no accumulation in memory. Maybe the driver keeps in mind the last used memory space and keep it for re-use? Or is it a problem with GPU-Z/Process Explorer and virtual memory? Or Is it a problem with my code? a problem with my video card? a problem in the driver? a problem in the OpenCL library (amdocl64.lib)?

Any help would be greatful!

Please find attached a small visual studio project to reproduce my problem if needed.

Best regards

0 Likes
1 Solution

Hi Yom,

As I've come to know, it's an internal runtime behavior. Runtime maintains a resource cache that allows to optimize some applications in certain scenarios. So, there is no issue with your code and the driver.

Regards,

View solution in original post

0 Likes
8 Replies
jtrudeau
Staff

Welcome. I have white listed you, and moved this to the OpenCL forum.

pinform

0 Likes

Thank you very much jtrudeau!

0 Likes
dipak
Big Boss

Hi Yom,

Right now, I'm not sure what may be the actual reason behind this observation. We'll check and get back to you shortly.

Regards,

0 Likes
dipak
Big Boss

Yes, I got similar observation as yours. But I'm not sure about the reason. I'll check with runtime team because they may provide better insight in this regard.

Thanks for sharing such interesting observation.

Regards,

0 Likes
yom
Journeyman III

Hi Dipak,

Thanks for your answer. Please let me know once you have more information about this problem.

Regards,

yom

0 Likes

Hi Yom,

As I've come to know, it's an internal runtime behavior. Runtime maintains a resource cache that allows to optimize some applications in certain scenarios. So, there is no issue with your code and the driver.

Regards,

0 Likes
yom
Journeyman III

Hi dipak,

Thank you very much for the explanation. But I wonder, is there any trick to avoid such behavior? Because in my case, I'm doing a lot of computation on GPU and I need to control how much memory is allocating/releasing...

Regards,

0 Likes

Actually, controlling the resource cache is not exposed to the application or user level, its an internal optimization technique.

0 Likes