Skip to content

Commit 9f559ae

Browse files
authored
[UR][OpenCL] Don't hold a reference to the adapter in context (#19048)
`ur_context_handle_t` was incrementing the adapter reference count on construction and decrementing it on destruction. This is pointless because the adapter will always be valid if the context is.
1 parent 9757b4f commit 9f559ae

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

unified-runtime/source/adapters/opencl/context.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ struct ur_context_handle_t_ : ur::opencl::handle_base {
3030
Devices.emplace_back(phDevices[i]);
3131
urDeviceRetain(phDevices[i]);
3232
}
33-
// The context retains a reference to the adapter so it can clear the
34-
// function ptr cache on destruction
35-
urAdapterRetain(ur::cl::getAdapter());
3633
RefCount = 1;
3734
}
3835

@@ -51,7 +48,6 @@ struct ur_context_handle_t_ : ur::opencl::handle_base {
5148
// should drastically reduce the chances of the pathological case described
5249
// in the comments in common.hpp.
5350
ur::cl::getAdapter()->fnCache.clearCache(CLContext);
54-
urAdapterRelease(ur::cl::getAdapter());
5551

5652
for (uint32_t i = 0; i < DeviceCount; i++) {
5753
urDeviceRelease(Devices[i]);

0 commit comments

Comments
 (0)