cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

timchist
Elite

Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

If one creates a context in the application main thread and then calls OpenCL functions utilizing this context from other threads (such as memory allocation/deallocation), OpenCL runtime creates 3 semaphores for each thread but not frees them when this thread is destroyed.

Attached is a sample code illustrating the problem.

Instructions -- on a machine with an AMD GPU (we tested on HD 7970) running Windows 7 x64:

1. Compile the application

2. Run Windows Task Manager

3. Make sure that the Handles column is shown (View > Select Columns..)

Note: it seems that Task Manager on Windows 8 does not have this menu, use other monitoring tools on that OS.

4. Run the application. Hit ENTER several times. Note that every time ENTER is pressed, the number of Handles consumed is increased by 3.

5. Use Windbg from Windows SDK to find out that the leaking handles represent semaphores and inspect the call stack within amdocl[64].dll

0 Likes
1 Solution

Accepted Solutions
timchist
Elite

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

Hi Himanshu,

it seems that the problem is not reproducible with 13.11 beta. Did not test in 13.10.

Regards,

Tim

View solution in original post

12 Replies
himanshu_gautam
Grandmaster

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

Thanks for reporting it. I will let you know my findings.

0 Likes
timchist
Elite

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

Hi Himanshu,

any progress on this?

Thanks, Tim

0 Likes
himanshu_gautam
Grandmaster

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

I am able to reproduce it, forwarding it to relevant people.

timchist
Elite

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

Thanks, Himanshu

0 Likes
himanshu_gautam
Grandmaster

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

This has been fixed in OCL runtime, and should be present in future driver releases.

0 Likes
timchist
Elite

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

As of Catalyst 13.9, the problem is still reproducible.

0 Likes
himanshu_gautam
Grandmaster

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

Will check and get back to you... Thanks

0 Likes
timchist
Elite

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

Any updates?

himanshu_gautam
Grandmaster

Re: Semaphore handle leak when host threads are destroyed on Windows

Jump to solution

The code has been fixed...

However, I am not sure which driver release it will appear.

I will ask around and find it... Please wait,

meanwhile, can you check 13.10 Beta -- if thats easy for you to do.

Thanks,

- Bruhaspati

0 Likes