@@ -130,11 +130,8 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
130130
131131ze_result_t DeviceImp::getCommandQueueGroupProperties (uint32_t *pCount,
132132 ze_command_queue_group_properties_t *pCommandQueueGroupProperties) {
133- NEO::Device *neoDevice = this ->neoDevice ;
134- if (this ->getNEODevice ()->getNumAvailableDevices () > 1 ) {
135- neoDevice = this ->neoDevice ->getDeviceById (0 );
136- }
137- auto engines = neoDevice->getEngineGroups ();
133+ NEO::Device *activeDevice = getActiveDevice ();
134+ auto engines = activeDevice->getEngineGroups ();
138135
139136 uint32_t numEngineGroups = 0 ;
140137 for (uint32_t i = 0 ; i < engines.size (); i++) {
@@ -527,10 +524,6 @@ uint32_t DeviceImp::getMaxNumHwThreads() const { return maxNumHwThreads; }
527524
528525const NEO::HardwareInfo &DeviceImp::getHwInfo () const { return neoDevice->getHardwareInfo (); }
529526
530- bool DeviceImp::isMultiDeviceCapable () const {
531- return neoDevice->getNumAvailableDevices () > 1u ;
532- }
533-
534527Device *Device::create (DriverHandle *driverHandle, NEO::Device *neoDevice, uint32_t currentDeviceMask, bool isSubDevice) {
535528 auto device = new DeviceImp;
536529 UNRECOVERABLE_IF (device == nullptr );
@@ -769,34 +762,20 @@ ze_result_t DeviceImp::getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr
769762 if (ret != ZE_RESULT_SUCCESS) {
770763 return ret;
771764 }
772- if (this ->getNEODevice ()->getNumAvailableDevices () > 1 ) {
773- if (index >= this ->neoDevice ->getDeviceById (0 )->getEngineGroups ()[engineGroupIndex].size ()) {
774- return ZE_RESULT_ERROR_INVALID_ARGUMENT;
775- }
776- *csr = this ->neoDevice ->getDeviceById (0 )->getEngineGroups ()[engineGroupIndex][index].commandStreamReceiver ;
777- } else {
778- if (index >= this ->neoDevice ->getEngineGroups ()[engineGroupIndex].size ()) {
779- return ZE_RESULT_ERROR_INVALID_ARGUMENT;
780- }
781- *csr = this ->neoDevice ->getEngineGroups ()[engineGroupIndex][index].commandStreamReceiver ;
765+ NEO::Device *activeDevice = getActiveDevice ();
766+ if (index >= activeDevice->getEngineGroups ()[engineGroupIndex].size ()) {
767+ return ZE_RESULT_ERROR_INVALID_ARGUMENT;
782768 }
769+ *csr = activeDevice->getEngineGroups ()[engineGroupIndex][index].commandStreamReceiver ;
783770 return ZE_RESULT_SUCCESS;
784771}
785772
786773ze_result_t DeviceImp::getCsrForLowPriority (NEO::CommandStreamReceiver **csr) {
787- if (this ->getNEODevice ()->getNumAvailableDevices () > 1 ) {
788- for (auto &it : neoDevice->getDeviceById (0 )->getEngines ()) {
789- if (it.osContext ->isLowPriority ()) {
790- *csr = it.commandStreamReceiver ;
791- return ZE_RESULT_SUCCESS;
792- }
793- }
794- } else {
795- for (auto &it : neoDevice->getEngines ()) {
796- if (it.osContext ->isLowPriority ()) {
797- *csr = it.commandStreamReceiver ;
798- return ZE_RESULT_SUCCESS;
799- }
774+ NEO::Device *activeDevice = getActiveDevice ();
775+ for (auto &it : activeDevice->getEngines ()) {
776+ if (it.osContext ->isLowPriority ()) {
777+ *csr = it.commandStreamReceiver ;
778+ return ZE_RESULT_SUCCESS;
800779 }
801780 }
802781 // if the code falls through, we have no low priority context created by neoDevice.
@@ -805,11 +784,8 @@ ze_result_t DeviceImp::getCsrForLowPriority(NEO::CommandStreamReceiver **csr) {
805784}
806785
807786ze_result_t DeviceImp::mapOrdinalForAvailableEngineGroup (uint32_t *ordinal) {
808- NEO::Device *neoDevice = this ->neoDevice ;
809- if (this ->getNEODevice ()->getNumAvailableDevices () > 1 ) {
810- neoDevice = this ->neoDevice ->getDeviceById (0 );
811- }
812- auto engines = neoDevice->getEngineGroups ();
787+ NEO::Device *activeDevice = getActiveDevice ();
788+ auto engines = activeDevice->getEngineGroups ();
813789 uint32_t numNonEmptyGroups = 0 ;
814790 uint32_t i = 0 ;
815791 for (; i < engines.size () && numNonEmptyGroups <= *ordinal; i++) {
0 commit comments