@@ -48,12 +48,15 @@ ClDevice::ClDevice(Device &device, ClDevice &rootClDevice, Platform *platform) :
4848 auto pClSubDevice = std::make_unique<ClDevice>(*subDevice, rootClDevice, platform);
4949 pClSubDevice->incRefInternal ();
5050 pClSubDevice->decRefApi ();
51-
52- auto &deviceInfo = pClSubDevice->deviceInfo ;
53- deviceInfo.parentDevice = this ;
54- deviceInfo.partitionType [0 ] = CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
55- deviceInfo.partitionType [1 ] = CL_DEVICE_AFFINITY_DOMAIN_NUMA;
56- deviceInfo.partitionType [2 ] = 0 ;
51+ pClSubDevice->internalParentDevice = this ;
52+
53+ if (!device.getExecutionEnvironment ()->isExposingSubDevicesAsDevices ()) {
54+ auto &deviceInfo = pClSubDevice->deviceInfo ;
55+ deviceInfo.parentDevice = this ;
56+ deviceInfo.partitionType [0 ] = CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
57+ deviceInfo.partitionType [1 ] = CL_DEVICE_AFFINITY_DOMAIN_NUMA;
58+ deviceInfo.partitionType [2 ] = 0 ;
59+ }
5760
5861 subDevices.push_back (std::move (pClSubDevice));
5962 }
@@ -70,33 +73,33 @@ ClDevice::~ClDevice() {
7073}
7174
7275void ClDevice::incRefInternal () {
73- if (deviceInfo. parentDevice == nullptr ) {
76+ if (internalParentDevice == nullptr ) {
7477 BaseObject<_cl_device_id>::incRefInternal ();
7578 return ;
7679 }
77- auto pParentDevice = static_cast <ClDevice *>(deviceInfo. parentDevice );
80+ auto pParentDevice = static_cast <ClDevice *>(internalParentDevice );
7881 pParentDevice->incRefInternal ();
7982}
8083
8184unique_ptr_if_unused<ClDevice> ClDevice::decRefInternal () {
82- if (deviceInfo. parentDevice == nullptr ) {
85+ if (internalParentDevice == nullptr ) {
8386 return BaseObject<_cl_device_id>::decRefInternal ();
8487 }
85- auto pParentDevice = static_cast <ClDevice *>(deviceInfo. parentDevice );
88+ auto pParentDevice = static_cast <ClDevice *>(internalParentDevice );
8689 return pParentDevice->decRefInternal ();
8790}
8891
8992void ClDevice::retainApi () {
9093 auto parentDeviceId = deviceInfo.parentDevice ;
91- if (( parentDeviceId && ! getExecutionEnvironment ()-> isExposingSubDevicesAsDevices ()) ) {
94+ if (parentDeviceId) {
9295 auto pParentClDevice = static_cast <ClDevice *>(parentDeviceId);
9396 pParentClDevice->incRefInternal ();
9497 this ->incRefApi ();
9598 }
9699};
97100unique_ptr_if_unused<ClDevice> ClDevice::releaseApi () {
98101 auto parentDeviceId = deviceInfo.parentDevice ;
99- if (!parentDeviceId || getExecutionEnvironment ()-> isExposingSubDevicesAsDevices () ) {
102+ if (!parentDeviceId) {
100103 return unique_ptr_if_unused<ClDevice>(this , false );
101104 }
102105 auto pParentClDevice = static_cast <ClDevice *>(parentDeviceId);
0 commit comments