You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issues aims at kick-starting a discussion on Loader termination issues.
For now, the ICD Loader doesn't provision any mechanism for termination when the application exits. It has two implications:
without taking layers into account, applications can call OpenCL functions in atexit callback, irrespective of when the callback was registered (before or after Loader initialization). At least from a loader perspective, as implementations could have different limitations, and I don't know this part of the spec enough to know what is required of implementations regarding termination;
layers that need to do something at program termination must use atexit to register a termination callback. This is fine as the callbacks will be called in the same order as the layer stack (top layer callback will be called first), so they can still issue OpenCL calls during their termination if required. Layers atexit callback will also be called before drivers registered ones, as layers are loaded after drivers.
A problem can arise from an application perspective if the application registers atexit callbacks that do OpenCL calls, depending on when the application does so.
if the application registers the atexit callback before the loader is initialized (by a call to clGetPlatformIDs or similar), the callback will be called after the layers' callback have been: this could lead to serious issues;
if the application registers the atexit callback after the loader is initialized, everything should be fine
The same applies to implementations that would register atexit callbacks.
So this raises a couple questions:
Should the spec mandate that application (or libraries) register atexit callbacks after Loader/OpenCL initialization;
Do we want the loader to orchestrate layers termination or keep the scheme unchanged.
Don't hesitate to ask for clarification if I didn't make myself clear.
The text was updated successfully, but these errors were encountered:
This issues aims at kick-starting a discussion on Loader termination issues.
For now, the ICD Loader doesn't provision any mechanism for termination when the application exits. It has two implications:
atexit
callback, irrespective of when the callback was registered (before or after Loader initialization). At least from a loader perspective, as implementations could have different limitations, and I don't know this part of the spec enough to know what is required of implementations regarding termination;atexit
to register a termination callback. This is fine as the callbacks will be called in the same order as the layer stack (top layer callback will be called first), so they can still issue OpenCL calls during their termination if required. Layersatexit
callback will also be called before drivers registered ones, as layers are loaded after drivers.A problem can arise from an application perspective if the application registers
atexit
callbacks that do OpenCL calls, depending on when the application does so.atexit
callback before the loader is initialized (by a call to clGetPlatformIDs or similar), the callback will be called after the layers' callback have been: this could lead to serious issues;atexit
callback after the loader is initialized, everything should be fineThe same applies to implementations that would register
atexit
callbacks.So this raises a couple questions:
atexit
callbacks after Loader/OpenCL initialization;Don't hesitate to ask for clarification if I didn't make myself clear.
The text was updated successfully, but these errors were encountered: