@@ -60,6 +60,9 @@ CommandQueue *CommandQueue::create(Context *context,
6060}
6161
6262CommandQueue::CommandQueue (Context *context, ClDevice *device, const cl_queue_properties *properties)
63+ : CommandQueue(context, device, properties, false ) {}
64+
65+ CommandQueue::CommandQueue (Context *context, ClDevice *device, const cl_queue_properties *properties, bool internalUsage)
6366 : context(context), device(device) {
6467 if (context) {
6568 context->incRefInternal ();
@@ -83,8 +86,10 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
8386 deferredTimestampPackets = std::make_unique<TimestampPacketContainer>();
8487 }
8588 if (bcsAllowed) {
86- auto &selectorCopyEngine = device->getDeviceById (0 )->getSelectorCopyEngine ();
87- bcsEngine = device->getDeviceById (0 )->getDevice ().tryGetEngine (EngineHelpers::getBcsEngineType (hwInfo, selectorCopyEngine), EngineUsage::Regular);
89+ auto &neoDevice = device->getDeviceById (0 )->getDevice ();
90+ auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine ();
91+ auto bcsEngineType = EngineHelpers::getBcsEngineType (hwInfo, selectorCopyEngine, internalUsage);
92+ bcsEngine = neoDevice.tryGetEngine (bcsEngineType, EngineUsage::Regular);
8893 }
8994 }
9095
@@ -109,6 +114,11 @@ CommandQueue::~CommandQueue() {
109114 if (this ->perfCountersEnabled ) {
110115 device->getPerformanceCounters ()->shutdown ();
111116 }
117+
118+ if (bcsEngine) {
119+ auto &selectorCopyEngine = device->getDeviceById (0 )->getSelectorCopyEngine ();
120+ EngineHelpers::releaseBcsEngineType (bcsEngine->getEngineType (), selectorCopyEngine);
121+ }
112122 }
113123
114124 timestampPacketContainer.reset ();
0 commit comments