Improve queries with number of SubDevices

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2021-08-31 16:49:46 +00:00 committed by Compute-Runtime-Automation
parent 69ae9dc9c2
commit 0345d9f707
44 changed files with 229 additions and 173 deletions

View File

@ -176,7 +176,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(z
auto surfaceState = GfxFamily::cmdInitRenderSurfaceState; auto surfaceState = GfxFamily::cmdInitRenderSurfaceState;
NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(&surfaceState, debugSurface->getGpuAddress(), NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(&surfaceState, debugSurface->getGpuAddress(),
debugSurface->getUnderlyingBufferSize(), mocs, debugSurface->getUnderlyingBufferSize(), mocs,
false, false, false, neoDevice->getNumAvailableDevices(), false, false, false, neoDevice->getNumGenericSubDevices(),
debugSurface, neoDevice->getGmmHelper(), kernelImp->getKernelDescriptor().kernelAttributes.flags.useGlobalAtomics, 1u); debugSurface, neoDevice->getGmmHelper(), kernelImp->getKernelDescriptor().kernelAttributes.flags.useGlobalAtomics, 1u);
*reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateSpace) = surfaceState; *reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateSpace) = surfaceState;
} }

View File

@ -26,34 +26,34 @@ template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommandListImmediateWithFlushTask(bool performMigration) { ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommandListImmediateWithFlushTask(bool performMigration) {
NEO::DispatchFlags dispatchFlags( NEO::DispatchFlags dispatchFlags(
{}, //csrDependencies {}, //csrDependencies
nullptr, //barrierTimestampPacketNodes nullptr, //barrierTimestampPacketNodes
{}, //pipelineSelectArgs {}, //pipelineSelectArgs
nullptr, //flushStampReference nullptr, //flushStampReference
NEO::QueueThrottle::MEDIUM, //throttle NEO::QueueThrottle::MEDIUM, //throttle
this->getCommandListPreemptionMode(), //preemptionMode this->getCommandListPreemptionMode(), //preemptionMode
this->commandContainer.lastSentNumGrfRequired, //numGrfRequired this->commandContainer.lastSentNumGrfRequired, //numGrfRequired
NEO::L3CachingSettings::l3CacheOn, //l3CacheSettings NEO::L3CachingSettings::l3CacheOn, //l3CacheSettings
this->getThreadArbitrationPolicy(), //threadArbitrationPolicy this->getThreadArbitrationPolicy(), //threadArbitrationPolicy
NEO::AdditionalKernelExecInfo::NotApplicable, //additionalKernelExecInfo NEO::AdditionalKernelExecInfo::NotApplicable, //additionalKernelExecInfo
NEO::KernelExecutionType::NotApplicable, //kernelExecutionType NEO::KernelExecutionType::NotApplicable, //kernelExecutionType
NEO::MemoryCompressionState::NotApplicable, //memoryCompressionState NEO::MemoryCompressionState::NotApplicable, //memoryCompressionState
NEO::QueueSliceCount::defaultSliceCount, //sliceCount NEO::QueueSliceCount::defaultSliceCount, //sliceCount
this->isSyncModeQueue, //blocking this->isSyncModeQueue, //blocking
this->isSyncModeQueue, //dcFlush this->isSyncModeQueue, //dcFlush
this->getCommandListSLMEnable(), //useSLM this->getCommandListSLMEnable(), //useSLM
this->isSyncModeQueue, //guardCommandBufferWithPipeControl this->isSyncModeQueue, //guardCommandBufferWithPipeControl
false, //GSBA32BitRequired false, //GSBA32BitRequired
false, //requiresCoherency false, //requiresCoherency
false, //lowPriority false, //lowPriority
true, //implicitFlush true, //implicitFlush
this->csr->isNTo1SubmissionModelEnabled(), //outOfOrderExecutionAllowed this->csr->isNTo1SubmissionModelEnabled(), //outOfOrderExecutionAllowed
false, //epilogueRequired false, //epilogueRequired
false, //usePerDssBackedBuffer false, //usePerDssBackedBuffer
false, //useSingleSubdevice false, //useSingleSubdevice
false, //useGlobalAtomics false, //useGlobalAtomics
this->device->getNEODevice()->getNumAvailableDevices() > 1, //areMultipleSubDevicesInContext this->device->getNEODevice()->getNumGenericSubDevices() > 1, //areMultipleSubDevicesInContext
false //memoryMigrationRequired false //memoryMigrationRequired
); );
this->commandContainer.removeDuplicatesFromResidencyContainer(); this->commandContainer.removeDuplicatesFromResidencyContainer();

View File

@ -242,7 +242,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(z
auto surfaceState = GfxFamily::cmdInitRenderSurfaceState; auto surfaceState = GfxFamily::cmdInitRenderSurfaceState;
NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(&surfaceState, debugSurface->getGpuAddress(), NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(&surfaceState, debugSurface->getGpuAddress(),
debugSurface->getUnderlyingBufferSize(), mocs, debugSurface->getUnderlyingBufferSize(), mocs,
false, false, false, neoDevice->getNumAvailableDevices(), false, false, false, neoDevice->getNumGenericSubDevices(),
debugSurface, neoDevice->getGmmHelper(), debugSurface, neoDevice->getGmmHelper(),
kernelDescriptor.kernelAttributes.flags.useGlobalAtomics, 1u); kernelDescriptor.kernelAttributes.flags.useGlobalAtomics, 1u);
*reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateSpace) = surfaceState; *reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateSpace) = surfaceState;

View File

@ -686,28 +686,23 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3
device->setDebugSurface(debugSurface); device->setDebugSurface(debugSurface);
} }
if (device->neoDevice->getNumAvailableDevices() == 1) { for (uint32_t i = 0; i < device->neoDevice->getNumSubDevices(); i++) {
device->numSubDevices = 0; if (!((1UL << i) & currentDeviceMask)) {
} else { continue;
for (uint32_t i = 0; i < device->neoDevice->getNumAvailableDevices(); i++) {
if (!((1UL << i) & currentDeviceMask)) {
continue;
}
ze_device_handle_t subDevice = Device::create(driverHandle,
device->neoDevice->getSubDevice(i),
0,
true, returnValue);
if (subDevice == nullptr) {
return nullptr;
}
static_cast<DeviceImp *>(subDevice)->isSubdevice = true;
static_cast<DeviceImp *>(subDevice)->setDebugSurface(debugSurface);
device->subDevices.push_back(static_cast<Device *>(subDevice));
} }
device->numSubDevices = static_cast<uint32_t>(device->subDevices.size());
ze_device_handle_t subDevice = Device::create(driverHandle,
device->neoDevice->getSubDevice(i),
0,
true, returnValue);
if (subDevice == nullptr) {
return nullptr;
}
static_cast<DeviceImp *>(subDevice)->isSubdevice = true;
static_cast<DeviceImp *>(subDevice)->setDebugSurface(debugSurface);
device->subDevices.push_back(static_cast<Device *>(subDevice));
} }
device->numSubDevices = static_cast<uint32_t>(device->subDevices.size());
if (neoDevice->getCompilerInterface()) { if (neoDevice->getCompilerInterface()) {
auto &hwInfo = neoDevice->getHardwareInfo(); auto &hwInfo = neoDevice->getHardwareInfo();

View File

@ -19,7 +19,7 @@ NEO::Device *DeviceImp::getActiveDevice() const {
} }
bool DeviceImp::isMultiDeviceCapable() const { bool DeviceImp::isMultiDeviceCapable() const {
return neoDevice->getNumAvailableDevices() > 1u; return neoDevice->getNumGenericSubDevices() > 1u;
} }
void DeviceImp::processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_module_properties_t *pKernelProperties) { void DeviceImp::processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_module_properties_t *pKernelProperties) {

View File

@ -69,7 +69,7 @@ struct KernelHw : public KernelImp {
NEO::Device *neoDevice = module->getDevice()->getNEODevice(); NEO::Device *neoDevice = module->getDevice()->getNEODevice();
NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(&surfaceState, bufferAddressForSsh, bufferSizeForSsh, mocs, NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(&surfaceState, bufferAddressForSsh, bufferSizeForSsh, mocs,
false, false, false, neoDevice->getNumAvailableDevices(), false, false, false, neoDevice->getNumGenericSubDevices(),
alloc, neoDevice->getGmmHelper(), alloc, neoDevice->getGmmHelper(),
kernelImmData->getDescriptor().kernelAttributes.flags.useGlobalAtomics, 1u); kernelImmData->getDescriptor().kernelAttributes.flags.useGlobalAtomics, 1u);
*reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateAddress) = surfaceState; *reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateAddress) = surfaceState;

View File

@ -93,7 +93,7 @@ inline void patchWithImplicitSurface(ArrayRef<uint8_t> crossThreadData, ArrayRef
void *addressToPatch = reinterpret_cast<void *>(allocation.getUnderlyingBuffer()); void *addressToPatch = reinterpret_cast<void *>(allocation.getUnderlyingBuffer());
size_t sizeToPatch = allocation.getUnderlyingBufferSize(); size_t sizeToPatch = allocation.getUnderlyingBufferSize();
NEO::Buffer::setSurfaceState(&device, surfaceState, false, false, sizeToPatch, addressToPatch, 0, NEO::Buffer::setSurfaceState(&device, surfaceState, false, false, sizeToPatch, addressToPatch, 0,
&allocation, 0, 0, useGlobalAtomics, device.getNumAvailableDevices() > 1); &allocation, 0, 0, useGlobalAtomics, device.getNumGenericSubDevices() > 1);
} }
} }

View File

@ -446,7 +446,7 @@ HWTEST2_F(CommandQueueProgramSBATest,
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumAvailableDevices() > 1, neoDevice->getRootDeviceIndex()); auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex());
MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get(); MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release()); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
NEO::MockGraphicsAllocation baseAllocation; NEO::MockGraphicsAllocation baseAllocation;
@ -485,7 +485,7 @@ HWTEST2_F(CommandQueueProgramSBATest,
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.UseBindlessMode.set(0); DebugManager.flags.UseBindlessMode.set(0);
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumAvailableDevices() > 1, neoDevice->getRootDeviceIndex()); auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex());
MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get(); MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release()); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
NEO::MockGraphicsAllocation baseAllocation; NEO::MockGraphicsAllocation baseAllocation;
@ -1010,7 +1010,7 @@ HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithSshAndScratchW
HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithWhenBindlessEnabledThenHeapContainerIsEmpty, CommandQueueExecuteTestSupport) { HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithWhenBindlessEnabledThenHeapContainerIsEmpty, CommandQueueExecuteTestSupport) {
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumAvailableDevices() > 1, neoDevice->getRootDeviceIndex()); auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release()); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
ze_command_queue_desc_t desc = {}; ze_command_queue_desc_t desc = {};
NEO::CommandStreamReceiver *csr; NEO::CommandStreamReceiver *csr;

View File

@ -1401,7 +1401,9 @@ TEST_F(KernelImpPatchBindlessTest, GivenKernelImpWhenPatchBindlessOffsetCalledTh
WhiteBox<::L0::DeviceImp> mockDevice; WhiteBox<::L0::DeviceImp> mockDevice;
mockDevice.neoDevice = neoDevice; mockDevice.neoDevice = neoDevice;
neoDevice->incRefInternal(); neoDevice->incRefInternal();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(), neoDevice->getNumAvailableDevices() > 1, neoDevice->getRootDeviceIndex()); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex());
Mock<Module> mockModule(&mockDevice, nullptr); Mock<Module> mockModule(&mockDevice, nullptr);
kernel.module = &mockModule; kernel.module = &mockModule;
NEO::MockGraphicsAllocation alloc; NEO::MockGraphicsAllocation alloc;
@ -1432,7 +1434,9 @@ HWTEST2_F(KernelImpPatchBindlessTest, GivenKernelImpWhenSetSurfaceStateBindlessT
arg.bindless = 0x40; arg.bindless = 0x40;
arg.bindful = undefined<SurfaceStateHeapOffset>; arg.bindful = undefined<SurfaceStateHeapOffset>;
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(), neoDevice->getNumAvailableDevices() > 1, neoDevice->getRootDeviceIndex()); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex());
auto &hwHelper = NEO::HwHelper::get(device->getHwInfo().platform.eRenderCoreFamily); auto &hwHelper = NEO::HwHelper::get(device->getHwInfo().platform.eRenderCoreFamily);
size_t size = hwHelper.getRenderSurfaceStateSize(); size_t size = hwHelper.getRenderSurfaceStateSize();
@ -1464,7 +1468,9 @@ HWTEST2_F(KernelImpPatchBindlessTest, GivenKernelImpWhenSetSurfaceStateBindfulTh
arg.bindless = undefined<CrossThreadDataOffset>; arg.bindless = undefined<CrossThreadDataOffset>;
arg.bindful = 0x40; arg.bindful = 0x40;
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(), neoDevice->getNumAvailableDevices() > 1, neoDevice->getRootDeviceIndex()); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex());
auto &hwHelper = NEO::HwHelper::get(device->getHwInfo().platform.eRenderCoreFamily); auto &hwHelper = NEO::HwHelper::get(device->getHwInfo().platform.eRenderCoreFamily);
size_t size = hwHelper.getRenderSurfaceStateSize(); size_t size = hwHelper.getRenderSurfaceStateSize();
@ -1737,7 +1743,9 @@ struct MyMockImage : public WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>> {
HWTEST2_F(SetKernelArg, givenImageAndBindlessKernelWhenSetArgImageThenCopySurfaceStateToSSHCalledWithCorrectArgs, ImageSupport) { HWTEST2_F(SetKernelArg, givenImageAndBindlessKernelWhenSetArgImageThenCopySurfaceStateToSSHCalledWithCorrectArgs, ImageSupport) {
createKernel(); createKernel();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(), neoDevice->getNumAvailableDevices() > 1, neoDevice->getRootDeviceIndex()); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex());
auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>()); auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>());
auto &addressingMode = kernel->kernelImmData->getDescriptor().kernelAttributes.imageAddressingMode; auto &addressingMode = kernel->kernelImmData->getDescriptor().kernelAttributes.imageAddressingMode;
const_cast<NEO::KernelDescriptor::AddressingMode &>(addressingMode) = NEO::KernelDescriptor::Bindless; const_cast<NEO::KernelDescriptor::AddressingMode &>(addressingMode) = NEO::KernelDescriptor::Bindless;

View File

@ -213,7 +213,7 @@ void MetricsLibrary::getSubDeviceClientOptions(
subDeviceIndex.SubDeviceIndex.Index = 0; subDeviceIndex.SubDeviceIndex.Index = 0;
subDeviceCount.Type = ClientOptionsType::SubDeviceCount; subDeviceCount.Type = ClientOptionsType::SubDeviceCount;
subDeviceCount.SubDeviceCount.Count = neoDevice.getNumAvailableDevices(); subDeviceCount.SubDeviceCount.Count = neoDevice.getNumSubDevices();
} else { } else {
@ -225,7 +225,7 @@ void MetricsLibrary::getSubDeviceClientOptions(
subDeviceIndex.SubDeviceIndex.Index = static_cast<NEO::SubDevice *>(&neoDevice)->getSubDeviceIndex(); subDeviceIndex.SubDeviceIndex.Index = static_cast<NEO::SubDevice *>(&neoDevice)->getSubDeviceIndex();
subDeviceCount.Type = ClientOptionsType::SubDeviceCount; subDeviceCount.Type = ClientOptionsType::SubDeviceCount;
subDeviceCount.SubDeviceCount.Count = neoDevice.getRootDevice()->getNumAvailableDevices(); subDeviceCount.SubDeviceCount.Count = neoDevice.getRootDevice()->getNumSubDevices();
} }
} }

View File

@ -899,7 +899,7 @@ TEST_F(MetricQueryPoolTest, givenRootDeviceWhenGetSubDeviceClientOptionsIsCalled
EXPECT_EQ(subDeviceIndex.SubDeviceIndex.Index, 0u); EXPECT_EQ(subDeviceIndex.SubDeviceIndex.Index, 0u);
EXPECT_EQ(subDeviceCount.Type, MetricsLibraryApi::ClientOptionsType::SubDeviceCount); EXPECT_EQ(subDeviceCount.Type, MetricsLibraryApi::ClientOptionsType::SubDeviceCount);
EXPECT_EQ(subDeviceCount.SubDeviceCount.Count, device->getNEODevice()->getNumAvailableDevices()); EXPECT_EQ(subDeviceCount.SubDeviceCount.Count, device->getNEODevice()->getNumSubDevices());
} }
TEST_F(MetricQueryPoolTest, givenSubDeviceWhenGetSubDeviceClientOptionsIsCalledThenReturnSubDeviceProperties) { TEST_F(MetricQueryPoolTest, givenSubDeviceWhenGetSubDeviceClientOptionsIsCalledThenReturnSubDeviceProperties) {
@ -914,7 +914,7 @@ TEST_F(MetricQueryPoolTest, givenSubDeviceWhenGetSubDeviceClientOptionsIsCalledT
auto subDeviceCount = ClientOptionsData_1_0{}; auto subDeviceCount = ClientOptionsData_1_0{};
// Sub devices // Sub devices
for (uint32_t i = 0, count = rootDevice->getNumAvailableDevices(); i < count; ++i) { for (uint32_t i = 0, count = rootDevice->getNumSubDevices(); i < count; ++i) {
metricsLibrary.getSubDeviceClientOptions(*rootDevice->subdevices[i], subDevice, subDeviceIndex, subDeviceCount); metricsLibrary.getSubDeviceClientOptions(*rootDevice->subdevices[i], subDevice, subDeviceIndex, subDeviceCount);
@ -925,7 +925,7 @@ TEST_F(MetricQueryPoolTest, givenSubDeviceWhenGetSubDeviceClientOptionsIsCalledT
EXPECT_EQ(subDeviceIndex.SubDeviceIndex.Index, i); EXPECT_EQ(subDeviceIndex.SubDeviceIndex.Index, i);
EXPECT_EQ(subDeviceCount.Type, MetricsLibraryApi::ClientOptionsType::SubDeviceCount); EXPECT_EQ(subDeviceCount.Type, MetricsLibraryApi::ClientOptionsType::SubDeviceCount);
EXPECT_EQ(subDeviceCount.SubDeviceCount.Count, rootDevice->getNumAvailableDevices()); EXPECT_EQ(subDeviceCount.SubDeviceCount.Count, rootDevice->getNumSubDevices());
} }
} }
} // namespace ult } // namespace ult

View File

@ -289,7 +289,7 @@ cl_int CL_API_CALL clCreateSubDevices(cl_device_id inDevice,
if (pInDevice == nullptr) { if (pInDevice == nullptr) {
return CL_INVALID_DEVICE; return CL_INVALID_DEVICE;
} }
auto subDevicesCount = pInDevice->getNumAvailableDevices(); auto subDevicesCount = pInDevice->getNumSubDevices();
if (subDevicesCount <= 1) { if (subDevicesCount <= 1) {
return CL_DEVICE_PARTITION_FAILED; return CL_DEVICE_PARTITION_FAILED;
} }

View File

@ -35,7 +35,7 @@ ClDevice::ClDevice(Device &device, ClDevice &rootClDevice, Platform *platform) :
compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(deviceInfo.deviceExtensions, emptyOpenClCFeatures); compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(deviceInfo.deviceExtensions, emptyOpenClCFeatures);
compilerExtensionsWithFeatures = convertEnabledExtensionsToCompilerInternalOptions(deviceInfo.deviceExtensions, deviceInfo.openclCFeatures); compilerExtensionsWithFeatures = convertEnabledExtensionsToCompilerInternalOptions(deviceInfo.deviceExtensions, deviceInfo.openclCFeatures);
auto numAvailableDevices = device.getNumAvailableDevices(); auto numAvailableDevices = device.getNumSubDevices();
if (numAvailableDevices > 1) { if (numAvailableDevices > 1) {
for (uint32_t i = 0; i < numAvailableDevices; i++) { for (uint32_t i = 0; i < numAvailableDevices; i++) {
auto &coreSubDevice = static_cast<SubDevice &>(*device.getSubDevice(i)); auto &coreSubDevice = static_cast<SubDevice &>(*device.getSubDevice(i));
@ -169,7 +169,8 @@ const HardwareCapabilities &ClDevice::getHardwareCapabilities() const { return d
bool ClDevice::isFullRangeSvm() const { return device.isFullRangeSvm(); } bool ClDevice::isFullRangeSvm() const { return device.isFullRangeSvm(); }
bool ClDevice::areSharedSystemAllocationsAllowed() const { return device.areSharedSystemAllocationsAllowed(); } bool ClDevice::areSharedSystemAllocationsAllowed() const { return device.areSharedSystemAllocationsAllowed(); }
uint32_t ClDevice::getRootDeviceIndex() const { return device.getRootDeviceIndex(); } uint32_t ClDevice::getRootDeviceIndex() const { return device.getRootDeviceIndex(); }
uint32_t ClDevice::getNumAvailableDevices() const { return device.getNumAvailableDevices(); } uint32_t ClDevice::getNumGenericSubDevices() const { return device.getNumGenericSubDevices(); }
uint32_t ClDevice::getNumSubDevices() const { return static_cast<uint32_t>(subDevices.size()); }
ClDeviceVector::ClDeviceVector(const cl_device_id *devices, ClDeviceVector::ClDeviceVector(const cl_device_id *devices,
cl_uint numDevices) { cl_uint numDevices) {

View File

@ -89,7 +89,8 @@ class ClDevice : public BaseObject<_cl_device_id> {
bool isFullRangeSvm() const; bool isFullRangeSvm() const;
bool areSharedSystemAllocationsAllowed() const; bool areSharedSystemAllocationsAllowed() const;
uint32_t getRootDeviceIndex() const; uint32_t getRootDeviceIndex() const;
uint32_t getNumAvailableDevices() const; uint32_t getNumGenericSubDevices() const;
uint32_t getNumSubDevices() const;
// API entry points // API entry points
cl_int getDeviceInfo(cl_device_info paramName, cl_int getDeviceInfo(cl_device_info paramName,

View File

@ -197,7 +197,7 @@ void ClDevice::initializeCaps() {
deviceExtensions += "cl_intel_media_block_io "; deviceExtensions += "cl_intel_media_block_io ";
} }
auto sharingAllowed = (getNumAvailableDevices() == 1u); auto sharingAllowed = (getNumGenericSubDevices() <= 1u);
if (sharingAllowed) { if (sharingAllowed) {
deviceExtensions += sharingFactory.getExtensions(driverInfo.get()); deviceExtensions += sharingFactory.getExtensions(driverInfo.get());
} }
@ -245,8 +245,8 @@ void ClDevice::initializeCaps() {
deviceInfo.deviceAvailable = CL_TRUE; deviceInfo.deviceAvailable = CL_TRUE;
deviceInfo.compilerAvailable = CL_TRUE; deviceInfo.compilerAvailable = CL_TRUE;
deviceInfo.parentDevice = nullptr; deviceInfo.parentDevice = nullptr;
deviceInfo.partitionMaxSubDevices = device.getNumAvailableDevices(); deviceInfo.partitionMaxSubDevices = device.getNumSubDevices();
if (deviceInfo.partitionMaxSubDevices > 1) { if (deviceInfo.partitionMaxSubDevices > 0) {
deviceInfo.partitionProperties[0] = CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN; deviceInfo.partitionProperties[0] = CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
deviceInfo.partitionProperties[1] = 0; deviceInfo.partitionProperties[1] = 0;
deviceInfo.partitionAffinityDomain = CL_DEVICE_AFFINITY_DOMAIN_NUMA | CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE; deviceInfo.partitionAffinityDomain = CL_DEVICE_AFFINITY_DOMAIN_NUMA | CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE;
@ -308,7 +308,11 @@ void ClDevice::initializeCaps() {
deviceInfo.maxWorkItemDimensions = 3; deviceInfo.maxWorkItemDimensions = 3;
deviceInfo.maxComputUnits = systemInfo.EUCount * getNumAvailableDevices(); deviceInfo.maxComputUnits = systemInfo.EUCount * std::max(getNumGenericSubDevices(), 1u);
if (device.isEngineInstanced()) {
deviceInfo.maxComputUnits /= systemInfo.CCSInfo.NumberOfCCSEnabled;
}
deviceInfo.maxConstantArgs = 8; deviceInfo.maxConstantArgs = 8;
deviceInfo.maxSliceCount = systemInfo.SliceCount; deviceInfo.maxSliceCount = systemInfo.SliceCount;

View File

@ -256,7 +256,7 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
retSize = srcSize = sizeof(cl_uint); retSize = srcSize = sizeof(cl_uint);
break; break;
case CL_DEVICE_NUM_SLICES_INTEL: case CL_DEVICE_NUM_SLICES_INTEL:
param.uint = static_cast<cl_uint>(getHardwareInfo().gtSystemInfo.SliceCount * ((subDevices.size() > 0) ? subDevices.size() : 1)); param.uint = static_cast<cl_uint>(getHardwareInfo().gtSystemInfo.SliceCount * std::max(device.getNumGenericSubDevices(), 1u));
src = &param.uint; src = &param.uint;
retSize = srcSize = sizeof(cl_uint); retSize = srcSize = sizeof(cl_uint);
break; break;

View File

@ -842,7 +842,7 @@ void CommandQueue::processProperties(const cl_queue_properties *properties) {
if (specificEngineSelected) { if (specificEngineSelected) {
this->queueFamilySelected = true; this->queueFamilySelected = true;
if (getDevice().getNumAvailableDevices() == 1) { if (!getDevice().hasRootCsr()) {
auto queueFamily = getDevice().getNonEmptyEngineGroup(selectedQueueFamilyIndex); auto queueFamily = getDevice().getNonEmptyEngineGroup(selectedQueueFamilyIndex);
const auto &engine = queueFamily->at(selectedQueueIndex); const auto &engine = queueFamily->at(selectedQueueIndex);
auto engineType = engine.getEngineType(); auto engineType = engine.getEngineType();

View File

@ -181,7 +181,7 @@ bool Context::createImpl(const cl_context_properties *properties,
bool containsDeviceWithSubdevices = false; bool containsDeviceWithSubdevices = false;
for (const auto &device : inputDevices) { for (const auto &device : inputDevices) {
rootDeviceIndices.insert(device->getRootDeviceIndex()); rootDeviceIndices.insert(device->getRootDeviceIndex());
containsDeviceWithSubdevices |= device->getNumAvailableDevices() > 1; containsDeviceWithSubdevices |= device->getNumGenericSubDevices() > 1;
} }
this->driverDiagnostics = driverDiagnostics.release(); this->driverDiagnostics = driverDiagnostics.release();
@ -472,6 +472,6 @@ Platform *Context::getPlatformFromProperties(const cl_context_properties *proper
} }
bool Context::isSingleDeviceContext() { bool Context::isSingleDeviceContext() {
return devices[0]->getNumAvailableDevices() == 1 && getNumDevices() == 1; return devices[0]->getNumGenericSubDevices() == 0 && getNumDevices() == 1;
} }
} // namespace NEO } // namespace NEO

View File

@ -42,7 +42,7 @@ void BufferHw<GfxFamily>::setArgStateful(void *memory, bool forceNonAuxMode, boo
EncodeSurfaceState<GfxFamily>::encodeBuffer(memory, getBufferAddress(rootDeviceIndex), EncodeSurfaceState<GfxFamily>::encodeBuffer(memory, getBufferAddress(rootDeviceIndex),
getSurfaceSize(alignSizeForAuxTranslation, rootDeviceIndex), getSurfaceSize(alignSizeForAuxTranslation, rootDeviceIndex),
getMocsValue(disableL3, isReadOnly, rootDeviceIndex), getMocsValue(disableL3, isReadOnly, rootDeviceIndex),
true, forceNonAuxMode, isReadOnly, device.getNumAvailableDevices(), true, forceNonAuxMode, isReadOnly, device.getNumGenericSubDevices(),
graphicsAllocation, device.getGmmHelper(), useGlobalAtomics, areMultipleSubDevicesInContext); graphicsAllocation, device.getGmmHelper(), useGlobalAtomics, areMultipleSubDevicesInContext);
appendSurfaceStateExt(memory); appendSurfaceStateExt(memory);
} }

View File

@ -29,13 +29,13 @@ std::unique_ptr<PerformanceCounters> PerformanceCounters::create(Device *device)
// Root device. // Root device.
counter->subDevice.Enabled = false; counter->subDevice.Enabled = false;
counter->subDeviceIndex.Index = 0; counter->subDeviceIndex.Index = 0;
counter->subDeviceCount.Count = device->getNumAvailableDevices(); counter->subDeviceCount.Count = device->getNumSubDevices();
} else { } else {
// Sub device. // Sub device.
counter->subDevice.Enabled = true; counter->subDevice.Enabled = true;
counter->subDeviceIndex.Index = static_cast<NEO::SubDevice *>(device)->getSubDeviceIndex(); counter->subDeviceIndex.Index = static_cast<NEO::SubDevice *>(device)->getSubDeviceIndex();
counter->subDeviceCount.Count = device->getRootDevice()->getNumAvailableDevices(); counter->subDeviceCount.Count = device->getRootDevice()->getNumSubDevices();
} }
// Adapter data. // Adapter data.

View File

@ -53,8 +53,8 @@ Program::Program(Context *context, bool isBuiltIn, const ClDeviceVector &clDevic
maxRootDeviceIndex = device->getRootDeviceIndex(); maxRootDeviceIndex = device->getRootDeviceIndex();
} }
deviceBuildInfos[device] = {}; deviceBuildInfos[device] = {};
if (device->getNumAvailableDevices() > 1) { if (device->getNumGenericSubDevices() > 1) {
for (auto i = 0u; i < device->getNumAvailableDevices(); i++) { for (auto i = 0u; i < device->getNumGenericSubDevices(); i++) {
auto subDevice = device->getNearestGenericSubDevice(i); auto subDevice = device->getNearestGenericSubDevice(i);
if (isDeviceAssociated(*subDevice)) { if (isDeviceAssociated(*subDevice)) {
deviceBuildInfos[device].associatedSubDevices.push_back(subDevice); deviceBuildInfos[device].associatedSubDevices.push_back(subDevice);

View File

@ -556,7 +556,7 @@ HWTEST_F(LowPriorityCommandQueueTest, GivenDeviceWithSubdevicesWhenCreatingLowPr
DebugManager.flags.CreateMultipleSubDevices.set(2); DebugManager.flags.CreateMultipleSubDevices.set(2);
MockContext context; MockContext context;
cl_queue_properties properties[] = {CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0}; cl_queue_properties properties[] = {CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0};
EXPECT_EQ(2u, context.getDevice(0)->getNumAvailableDevices()); EXPECT_EQ(2u, context.getDevice(0)->getNumGenericSubDevices());
auto cmdQ = clCreateCommandQueueWithProperties(&context, context.getDevice(0), properties, nullptr); auto cmdQ = clCreateCommandQueueWithProperties(&context, context.getDevice(0), properties, nullptr);
auto commandQueueObj = castToObject<CommandQueue>(cmdQ); auto commandQueueObj = castToObject<CommandQueue>(cmdQ);

View File

@ -296,7 +296,7 @@ HWTEST_P(CommandQueueWithBlitOperationsTests, givenDeviceWithSubDevicesSupportin
REQUIRE_BLITTER_OR_SKIP(&hwInfo); REQUIRE_BLITTER_OR_SKIP(&hwInfo);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo)); auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
EXPECT_EQ(2u, device->getNumAvailableDevices()); EXPECT_EQ(2u, device->getNumGenericSubDevices());
std::unique_ptr<OsContext> bcsOsContext; std::unique_ptr<OsContext> bcsOsContext;
auto subDevice = device->getSubDevice(0); auto subDevice = device->getSubDevice(0);

View File

@ -193,7 +193,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, GetCommandQueueFamilyInfoTests, givenFamilyIdWhenGe
auto context = clCreateContext(nullptr, 1, &deviceId, nullptr, nullptr, nullptr); auto context = clCreateContext(nullptr, 1, &deviceId, nullptr, nullptr, nullptr);
auto ccsFamily = mockClDevice.getDevice().getIndexOfNonEmptyEngineGroup(EngineGroupType::Compute); auto ccsFamily = mockClDevice.getDevice().getIndexOfNonEmptyEngineGroup(EngineGroupType::Compute);
cl_command_queue_properties properties[] = {CL_QUEUE_FAMILY_INTEL, ccsFamily, CL_QUEUE_INDEX_INTEL, 0, 0}; cl_command_queue_properties properties[] = {CL_QUEUE_FAMILY_INTEL, ccsFamily, CL_QUEUE_INDEX_INTEL, 0, 0};
EXPECT_EQ(1u, mockClDevice.getNumAvailableDevices()); EXPECT_EQ(0u, mockClDevice.getNumGenericSubDevices());
auto commandQueue = clCreateCommandQueueWithProperties(context, deviceId, properties, nullptr); auto commandQueue = clCreateCommandQueueWithProperties(context, deviceId, properties, nullptr);
auto neoQueue = castToObject<CommandQueue>(commandQueue); auto neoQueue = castToObject<CommandQueue>(commandQueue);
@ -229,7 +229,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, GetCommandQueueFamilyInfoTests, givenFamilyIdWhenCr
auto context = clCreateContext(nullptr, 1, &deviceId, nullptr, nullptr, nullptr); auto context = clCreateContext(nullptr, 1, &deviceId, nullptr, nullptr, nullptr);
cl_command_queue_properties properties[] = {CL_QUEUE_FAMILY_INTEL, static_cast<uint32_t>(EngineGroupType::Compute), CL_QUEUE_INDEX_INTEL, 0, 0}; cl_command_queue_properties properties[] = {CL_QUEUE_FAMILY_INTEL, static_cast<uint32_t>(EngineGroupType::Compute), CL_QUEUE_INDEX_INTEL, 0, 0};
EXPECT_EQ(2u, rootDevice->getNumAvailableDevices()); EXPECT_EQ(2u, rootDevice->getNumGenericSubDevices());
cl_int retVal; cl_int retVal;
auto commandQueue = clCreateCommandQueueWithProperties(context, rootDevice, properties, &retVal); auto commandQueue = clCreateCommandQueueWithProperties(context, rootDevice, properties, &retVal);

View File

@ -325,8 +325,8 @@ TEST(DeviceCreation, givenDeviceWhenItIsCreatedThenOsContextIsRegistredInMemoryM
auto memoryManager = device->getMemoryManager(); auto memoryManager = device->getMemoryManager();
auto &hwInfo = device->getHardwareInfo(); auto &hwInfo = device->getHardwareInfo();
auto numEnginesForDevice = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo).size(); auto numEnginesForDevice = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo).size();
if (device->getNumAvailableDevices() > 1) { if (device->getNumGenericSubDevices() > 1) {
numEnginesForDevice *= device->getNumAvailableDevices(); numEnginesForDevice *= device->getNumGenericSubDevices();
numEnginesForDevice += device->engines.size(); numEnginesForDevice += device->engines.size();
} }
EXPECT_EQ(numEnginesForDevice, memoryManager->getRegisteredEnginesCount()); EXPECT_EQ(numEnginesForDevice, memoryManager->getRegisteredEnginesCount());

View File

@ -1080,7 +1080,7 @@ struct DeviceAttributeQueryTest : public ::testing::TestWithParam<uint32_t /*cl_
case CL_DEVICE_NUM_SLICES_INTEL: { case CL_DEVICE_NUM_SLICES_INTEL: {
auto pNumSlices = reinterpret_cast<cl_uint *>(object.get()); auto pNumSlices = reinterpret_cast<cl_uint *>(object.get());
const auto &gtSysInfo = device.getHardwareInfo().gtSystemInfo; const auto &gtSysInfo = device.getHardwareInfo().gtSystemInfo;
EXPECT_EQ(gtSysInfo.SliceCount * device.getNumAvailableDevices(), *pNumSlices); EXPECT_EQ(gtSysInfo.SliceCount * std::max(device.getNumGenericSubDevices(), 1u), *pNumSlices);
EXPECT_EQ(sizeof(cl_uint), sizeReturned); EXPECT_EQ(sizeof(cl_uint), sizeReturned);
break; break;
} }

View File

@ -28,7 +28,7 @@ TEST(SubDevicesTest, givenDefaultConfigWhenCreateRootDeviceThenItDoesntContainSu
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())); auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
EXPECT_EQ(0u, device->getNumSubDevices()); EXPECT_EQ(0u, device->getNumSubDevices());
EXPECT_EQ(1u, device->getNumAvailableDevices()); EXPECT_EQ(0u, device->getNumGenericSubDevices());
} }
TEST(SubDevicesTest, givenCreateMultipleSubDevicesFlagSetWhenCreateRootDeviceThenItsSubdevicesHaveProperRootIdSet) { TEST(SubDevicesTest, givenCreateMultipleSubDevicesFlagSetWhenCreateRootDeviceThenItsSubdevicesHaveProperRootIdSet) {
@ -55,9 +55,9 @@ TEST(SubDevicesTest, givenCreateMultipleSubDevicesFlagSetWhenCreateRootDeviceThe
EXPECT_EQ(2u, device->getNumSubDevices()); EXPECT_EQ(2u, device->getNumSubDevices());
EXPECT_EQ(2u, device->getNumAvailableDevices()); EXPECT_EQ(2u, device->getNumGenericSubDevices());
EXPECT_EQ(1u, device->subdevices.at(0)->getNumAvailableDevices()); EXPECT_EQ(0u, device->subdevices.at(0)->getNumGenericSubDevices());
EXPECT_EQ(1u, device->subdevices.at(1)->getNumAvailableDevices()); EXPECT_EQ(0u, device->subdevices.at(1)->getNumGenericSubDevices());
} }
TEST(SubDevicesTest, givenDeviceWithSubDevicesWhenSubDeviceApiRefCountsAreChangedThenChangeIsPropagatedToRootDevice) { TEST(SubDevicesTest, givenDeviceWithSubDevicesWhenSubDeviceApiRefCountsAreChangedThenChangeIsPropagatedToRootDevice) {
@ -204,7 +204,7 @@ TEST(SubDevicesTest, givenSubDeviceWhenOsContextIsCreatedThenItsBitfieldBasesOnS
TEST(SubDevicesTest, givenDeviceWithoutSubDevicesWhenGettingDeviceByIdZeroThenGetThisDevice) { TEST(SubDevicesTest, givenDeviceWithoutSubDevicesWhenGettingDeviceByIdZeroThenGetThisDevice) {
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())); auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
EXPECT_EQ(1u, device->getNumAvailableDevices()); EXPECT_EQ(0u, device->getNumGenericSubDevices());
EXPECT_ANY_THROW(device->getSubDevice(0u)); EXPECT_ANY_THROW(device->getSubDevice(0u));
} }
@ -248,10 +248,10 @@ TEST(RootDevicesTest, givenRootDeviceWithSubdevicesWhenCreateEnginesThenDeviceCr
auto executionEnvironment = new MockExecutionEnvironment; auto executionEnvironment = new MockExecutionEnvironment;
MockDevice device(executionEnvironment, 0); MockDevice device(executionEnvironment, 0);
device.createSubDevices();
EXPECT_EQ(2u, device.getNumAvailableDevices());
EXPECT_EQ(0u, device.engines.size()); EXPECT_EQ(0u, device.engines.size());
device.createSubDevices();
device.createEngines(); device.createEngines();
EXPECT_EQ(2u, device.getNumGenericSubDevices());
EXPECT_EQ(1u, device.engines.size()); EXPECT_EQ(1u, device.engines.size());
} }
@ -328,7 +328,8 @@ struct EngineInstancedDeviceTests : public ::testing::Test {
bool isEngineInstanced(MockSubDevice *subDevice, aub_stream::EngineType engineType, uint32_t subDeviceIndex, DeviceBitfield deviceBitfield) { bool isEngineInstanced(MockSubDevice *subDevice, aub_stream::EngineType engineType, uint32_t subDeviceIndex, DeviceBitfield deviceBitfield) {
bool isEngineInstanced = !subDevice->engines[0].osContext->isRootDevice(); bool isEngineInstanced = !subDevice->engines[0].osContext->isRootDevice();
isEngineInstanced &= subDevice->engineInstanced; isEngineInstanced &= subDevice->engineInstanced;
isEngineInstanced &= (subDevice->getNumAvailableDevices() == 1); isEngineInstanced &= (subDevice->getNumGenericSubDevices() == 0);
isEngineInstanced &= (subDevice->getNumSubDevices() == 0);
isEngineInstanced &= (engineType == subDevice->engineInstancedType); isEngineInstanced &= (engineType == subDevice->engineInstancedType);
isEngineInstanced &= (subDeviceIndex == subDevice->getSubDeviceIndex()); isEngineInstanced &= (subDeviceIndex == subDevice->getSubDeviceIndex());
isEngineInstanced &= (deviceBitfield == subDevice->getDeviceBitfield()); isEngineInstanced &= (deviceBitfield == subDevice->getDeviceBitfield());
@ -400,7 +401,8 @@ TEST_F(EngineInstancedDeviceTests, givenDebugFlagSetAndMoreThanOneCcsWhenCreatin
auto &hwInfo = rootDevice->getHardwareInfo(); auto &hwInfo = rootDevice->getHardwareInfo();
EXPECT_EQ(ccsCount, hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled); EXPECT_EQ(ccsCount, hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
EXPECT_EQ(ccsCount, rootDevice->getNumAvailableDevices()); EXPECT_EQ(ccsCount, rootDevice->getNumSubDevices());
EXPECT_EQ(0u, rootDevice->getNumGenericSubDevices());
EXPECT_FALSE(hasRootCsrOnly(rootDevice)); EXPECT_FALSE(hasRootCsrOnly(rootDevice));
EXPECT_TRUE(hasAllEngines(rootDevice)); EXPECT_TRUE(hasAllEngines(rootDevice));
@ -424,7 +426,8 @@ TEST_F(EngineInstancedDeviceTests, givenDebugFlagSetAndZeroCcsesWhenCreatingRoot
EXPECT_FALSE(hasRootCsrOnly(rootDevice)); EXPECT_FALSE(hasRootCsrOnly(rootDevice));
EXPECT_TRUE(hasAllEngines(rootDevice)); EXPECT_TRUE(hasAllEngines(rootDevice));
EXPECT_EQ(1u, rootDevice->getNumAvailableDevices()); EXPECT_EQ(0u, rootDevice->getNumGenericSubDevices());
EXPECT_EQ(0u, rootDevice->getNumSubDevices());
EXPECT_FALSE(rootDevice->getNearestGenericSubDevice(0)->isSubDevice()); EXPECT_FALSE(rootDevice->getNearestGenericSubDevice(0)->isSubDevice());
} }
@ -439,7 +442,8 @@ TEST_F(EngineInstancedDeviceTests, givenDebugFlagSetAndSingleCcsWhenCreatingRoot
EXPECT_FALSE(hasRootCsrOnly(rootDevice)); EXPECT_FALSE(hasRootCsrOnly(rootDevice));
EXPECT_TRUE(hasAllEngines(rootDevice)); EXPECT_TRUE(hasAllEngines(rootDevice));
EXPECT_EQ(1u, rootDevice->getNumAvailableDevices()); EXPECT_EQ(0u, rootDevice->getNumGenericSubDevices());
EXPECT_EQ(0u, rootDevice->getNumSubDevices());
EXPECT_FALSE(rootDevice->getNearestGenericSubDevice(0)->isSubDevice()); EXPECT_FALSE(rootDevice->getNearestGenericSubDevice(0)->isSubDevice());
} }
@ -457,7 +461,8 @@ TEST_F(EngineInstancedDeviceTests, givenDebugFlagSetWhenCreatingRootDeviceWithGe
EXPECT_FALSE(subDevice->engines[0].osContext->isRootDevice()); EXPECT_FALSE(subDevice->engines[0].osContext->isRootDevice());
EXPECT_FALSE(subDevice->engineInstanced); EXPECT_FALSE(subDevice->engineInstanced);
EXPECT_EQ(1u, subDevice->getNumAvailableDevices()); EXPECT_EQ(0u, subDevice->getNumGenericSubDevices());
EXPECT_EQ(0u, subDevice->getNumSubDevices());
EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType); EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType);
EXPECT_TRUE(hasAllEngines(subDevice)); EXPECT_TRUE(hasAllEngines(subDevice));
@ -480,7 +485,8 @@ TEST_F(EngineInstancedDeviceTests, givenDebugFlagSetWhenCreatingRootDeviceWithGe
EXPECT_FALSE(subDevice->engines[0].osContext->isRootDevice()); EXPECT_FALSE(subDevice->engines[0].osContext->isRootDevice());
EXPECT_FALSE(subDevice->engineInstanced); EXPECT_FALSE(subDevice->engineInstanced);
EXPECT_EQ(1u, subDevice->getNumAvailableDevices()); EXPECT_EQ(0u, subDevice->getNumGenericSubDevices());
EXPECT_EQ(0u, subDevice->getNumSubDevices());
EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType); EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType);
EXPECT_TRUE(hasAllEngines(subDevice)); EXPECT_TRUE(hasAllEngines(subDevice));
@ -503,7 +509,8 @@ TEST_F(EngineInstancedDeviceTests, givenDebugFlagSetWhenCreatingRootDeviceWithGe
EXPECT_FALSE(subDevice->engines[0].osContext->isRootDevice()); EXPECT_FALSE(subDevice->engines[0].osContext->isRootDevice());
EXPECT_FALSE(subDevice->engineInstanced); EXPECT_FALSE(subDevice->engineInstanced);
EXPECT_EQ(ccsCount, subDevice->getNumAvailableDevices()); EXPECT_EQ(0u, subDevice->getNumGenericSubDevices());
EXPECT_EQ(ccsCount, subDevice->getNumSubDevices());
EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType); EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType);
EXPECT_TRUE(hasAllEngines(subDevice)); EXPECT_TRUE(hasAllEngines(subDevice));
@ -639,7 +646,8 @@ TEST_F(EngineInstancedDeviceTests, givenAffinityMaskSetWhenCreatingDevicesThenFi
EXPECT_FALSE(subDevice->engines[0].osContext->isRootDevice()); EXPECT_FALSE(subDevice->engines[0].osContext->isRootDevice());
EXPECT_FALSE(subDevice->engineInstanced); EXPECT_FALSE(subDevice->engineInstanced);
EXPECT_EQ(engineInstancedPerGeneric[i], subDevice->getNumAvailableDevices()); EXPECT_EQ(engineInstancedPerGeneric[i], subDevice->getNumSubDevices());
EXPECT_EQ(0u, subDevice->getNumGenericSubDevices());
EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType); EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType);
EXPECT_TRUE(hasAllEngines(subDevice)); EXPECT_TRUE(hasAllEngines(subDevice));
@ -687,7 +695,8 @@ TEST_F(EngineInstancedDeviceTests, givenAffinityMaskForSingle3rdLevelDeviceWhenC
EXPECT_TRUE(isEngineInstanced(subDevice, engineType, i, deviceBitfield)); EXPECT_TRUE(isEngineInstanced(subDevice, engineType, i, deviceBitfield));
EXPECT_TRUE(hasEngineInstancedEngines(subDevice, engineType)); EXPECT_TRUE(hasEngineInstancedEngines(subDevice, engineType));
EXPECT_EQ(1u, subDevice->getNumAvailableDevices()); EXPECT_EQ(0u, subDevice->getNumGenericSubDevices());
EXPECT_EQ(0u, subDevice->getNumSubDevices());
continue; continue;
} }
@ -697,7 +706,8 @@ TEST_F(EngineInstancedDeviceTests, givenAffinityMaskForSingle3rdLevelDeviceWhenC
EXPECT_FALSE(subDevice->engineInstanced); EXPECT_FALSE(subDevice->engineInstanced);
EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType); EXPECT_EQ(aub_stream::EngineType::NUM_ENGINES, subDevice->engineInstancedType);
EXPECT_EQ(ccsCount, subDevice->getNumAvailableDevices()); EXPECT_EQ(0u, subDevice->getNumGenericSubDevices());
EXPECT_EQ(ccsCount, subDevice->getNumSubDevices());
for (uint32_t j = 0; j < ccsCount; j++) { for (uint32_t j = 0; j < ccsCount; j++) {
auto engineType = static_cast<aub_stream::EngineType>(aub_stream::EngineType::ENGINE_CCS + j); auto engineType = static_cast<aub_stream::EngineType>(aub_stream::EngineType::ENGINE_CCS + j);
@ -730,7 +740,8 @@ TEST_F(EngineInstancedDeviceTests, givenAffinityMaskForSingle3rdLevelDeviceOnlyW
EXPECT_FALSE(rootDevice->engines[0].osContext->isRootDevice()); EXPECT_FALSE(rootDevice->engines[0].osContext->isRootDevice());
EXPECT_TRUE(rootDevice->engineInstanced); EXPECT_TRUE(rootDevice->engineInstanced);
EXPECT_TRUE(rootDevice->getNumAvailableDevices() == 1); EXPECT_TRUE(rootDevice->getNumGenericSubDevices() == 0);
EXPECT_TRUE(rootDevice->getNumSubDevices() == 0);
EXPECT_TRUE(engineType == rootDevice->engineInstancedType); EXPECT_TRUE(engineType == rootDevice->engineInstancedType);
EXPECT_TRUE(deviceBitfield == rootDevice->getDeviceBitfield()); EXPECT_TRUE(deviceBitfield == rootDevice->getDeviceBitfield());
EXPECT_EQ(1u, rootDevice->getDeviceBitfield().count()); EXPECT_EQ(1u, rootDevice->getDeviceBitfield().count());
@ -758,7 +769,8 @@ TEST_F(EngineInstancedDeviceTests, givenAffinityMaskForSingle2rdLevelDeviceOnlyW
EXPECT_FALSE(rootDevice->engines[0].osContext->isRootDevice()); EXPECT_FALSE(rootDevice->engines[0].osContext->isRootDevice());
EXPECT_TRUE(rootDevice->engineInstanced); EXPECT_TRUE(rootDevice->engineInstanced);
EXPECT_TRUE(rootDevice->getNumAvailableDevices() == 1); EXPECT_TRUE(rootDevice->getNumGenericSubDevices() == 0);
EXPECT_TRUE(rootDevice->getNumSubDevices() == 0);
EXPECT_TRUE(engineType == rootDevice->engineInstancedType); EXPECT_TRUE(engineType == rootDevice->engineInstancedType);
EXPECT_TRUE(deviceBitfield == rootDevice->getDeviceBitfield()); EXPECT_TRUE(deviceBitfield == rootDevice->getDeviceBitfield());
EXPECT_EQ(1u, rootDevice->getDeviceBitfield().count()); EXPECT_EQ(1u, rootDevice->getDeviceBitfield().count());
@ -807,6 +819,6 @@ TEST(SubDevicesTest, givenCreateMultipleSubDevicesFlagSetWhenBindlessHeapHelperC
VariableBackup<bool> mockDeviceFlagBackup(&MockDevice::createSingleDevice, false); VariableBackup<bool> mockDeviceFlagBackup(&MockDevice::createSingleDevice, false);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())); auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->createBindlessHeapsHelper(device->getMemoryManager(), device->getNumAvailableDevices() > 1, device->getRootDeviceIndex()); device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->createBindlessHeapsHelper(device->getMemoryManager(), device->getNumGenericSubDevices() > 1, device->getRootDeviceIndex());
EXPECT_EQ(device->getBindlessHeapsHelper(), device->subdevices.at(0)->getBindlessHeapsHelper()); EXPECT_EQ(device->getBindlessHeapsHelper(), device->subdevices.at(0)->getBindlessHeapsHelper());
} }

View File

@ -63,11 +63,11 @@ TEST(ExecutionEnvironment, WhenCreatingDevicesThenThoseDevicesAddRefcountsToExec
auto expectedRefCounts = executionEnvironment->getRefInternalCount(); auto expectedRefCounts = executionEnvironment->getRefInternalCount();
auto devices = DeviceFactory::createDevices(*executionEnvironment); auto devices = DeviceFactory::createDevices(*executionEnvironment);
EXPECT_LT(0u, devices[0]->getNumAvailableDevices()); EXPECT_LE(0u, devices[0]->getNumSubDevices());
if (devices[0]->getNumAvailableDevices() > 1) { if (devices[0]->getNumSubDevices() > 1) {
expectedRefCounts++; expectedRefCounts++;
} }
expectedRefCounts += devices[0]->getNumAvailableDevices(); expectedRefCounts += std::max(devices[0]->getNumSubDevices(), 1u);
EXPECT_EQ(expectedRefCounts, executionEnvironment->getRefInternalCount()); EXPECT_EQ(expectedRefCounts, executionEnvironment->getRefInternalCount());
} }

View File

@ -575,7 +575,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, RenderSurfaceStateXeHPAndLaterTests, givenSpecificP
EncodeSurfaceState<FamilyType>::encodeBuffer(&rssCmd, allocation->getGpuAddress(), allocation->getUnderlyingBufferSize(), EncodeSurfaceState<FamilyType>::encodeBuffer(&rssCmd, allocation->getGpuAddress(), allocation->getUnderlyingBufferSize(),
buffer->getMocsValue(false, false, pClDevice->getRootDeviceIndex()), false, false, false, buffer->getMocsValue(false, false, pClDevice->getRootDeviceIndex()), false, false, false,
pClDevice->getNumAvailableDevices(), allocation, pClDevice->getGmmHelper(), false, 1u); pClDevice->getNumGenericSubDevices(), allocation, pClDevice->getGmmHelper(), false, 1u);
EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT, rssCmd.getCoherencyType()); EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT, rssCmd.getCoherencyType());
} }

View File

@ -35,7 +35,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenContextTypeDefaultWhe
DebugManagerStateRestore restorer; DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(1); DebugManager.flags.CreateMultipleSubDevices.set(1);
initPlatform(); initPlatform();
EXPECT_EQ(1u, platform()->getClDevice(0)->getNumAvailableDevices()); EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0)); MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT; context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
@ -280,7 +280,12 @@ HWCMDTEST_P(IGFX_XE_HP_CORE, MultiGpuGlobalAtomicsBufferTest, givenSetArgStatefu
DebugManager.flags.CreateMultipleSubDevices.set(numAvailableDevices); DebugManager.flags.CreateMultipleSubDevices.set(numAvailableDevices);
DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization); DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization);
initPlatform(); initPlatform();
EXPECT_EQ(numAvailableDevices, platform()->getClDevice(0)->getNumAvailableDevices());
if (numAvailableDevices == 1) {
EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
} else {
EXPECT_EQ(numAvailableDevices, platform()->getClDevice(0)->getNumGenericSubDevices());
}
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0)); MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT; context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
@ -322,7 +327,11 @@ HWCMDTEST_P(IGFX_XE_HP_CORE, MultiGpuGlobalAtomicsBufferTest, givenSetSurfaceSta
DebugManager.flags.CreateMultipleSubDevices.set(numAvailableDevices); DebugManager.flags.CreateMultipleSubDevices.set(numAvailableDevices);
DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization); DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization);
initPlatform(); initPlatform();
EXPECT_EQ(numAvailableDevices, platform()->getClDevice(0)->getNumAvailableDevices()); if (numAvailableDevices == 1) {
EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
} else {
EXPECT_EQ(numAvailableDevices, platform()->getClDevice(0)->getNumGenericSubDevices());
}
auto size = MemoryConstants::pageSize; auto size = MemoryConstants::pageSize;
auto ptr = alignedMalloc(size, MemoryConstants::pageSize); auto ptr = alignedMalloc(size, MemoryConstants::pageSize);

View File

@ -33,7 +33,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterImageTests, givenContextTypeDefaultWhen
DebugManagerStateRestore restorer; DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(1); DebugManager.flags.CreateMultipleSubDevices.set(1);
initPlatform(); initPlatform();
EXPECT_EQ(1u, platform()->getClDevice(0)->getNumAvailableDevices()); EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0)); MockContext context(platform()->getClDevice(0));
context.contextType = ContextType::CONTEXT_TYPE_DEFAULT; context.contextType = ContextType::CONTEXT_TYPE_DEFAULT;
@ -269,7 +269,11 @@ HWCMDTEST_P(IGFX_XE_HP_CORE, MultiGpuGlobalAtomicsImageTest, givenAppendSurfaceS
DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization); DebugManager.flags.EnableMultiGpuAtomicsOptimization.set(enableMultiGpuAtomicsOptimization);
DebugManager.flags.CreateMultipleSubDevices.set(numAvailableDevices); DebugManager.flags.CreateMultipleSubDevices.set(numAvailableDevices);
initPlatform(); initPlatform();
EXPECT_EQ(numAvailableDevices, platform()->getClDevice(0)->getNumAvailableDevices()); if (numAvailableDevices == 1) {
EXPECT_EQ(0u, platform()->getClDevice(0)->getNumGenericSubDevices());
} else {
EXPECT_EQ(numAvailableDevices, platform()->getClDevice(0)->getNumGenericSubDevices());
}
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockContext context(platform()->getClDevice(0)); MockContext context(platform()->getClDevice(0));
context.contextType = contextType; context.contextType = contextType;

View File

@ -107,10 +107,10 @@ TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetWhenCreateDevicesThenProperNumbe
auto devices = DeviceFactory::createDevices(*executionEnvironment); auto devices = DeviceFactory::createDevices(*executionEnvironment);
EXPECT_EQ(devices.size(), 4u); EXPECT_EQ(devices.size(), 4u);
EXPECT_EQ(devices[0]->getNumAvailableDevices(), 4u); EXPECT_EQ(devices[0]->getNumSubDevices(), 4u);
EXPECT_EQ(devices[1]->getNumAvailableDevices(), 2u); EXPECT_EQ(devices[1]->getNumSubDevices(), 2u);
EXPECT_EQ(devices[2]->getNumAvailableDevices(), 3u); EXPECT_EQ(devices[2]->getNumSubDevices(), 3u);
EXPECT_EQ(devices[3]->getNumAvailableDevices(), 4u); EXPECT_EQ(devices[3]->getNumSubDevices(), 4u);
} }
TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToGreaterRootDeviceThanAvailableWhenCreateDevicesThenProperNumberOfDevicesIsReturned) { TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToGreaterRootDeviceThanAvailableWhenCreateDevicesThenProperNumberOfDevicesIsReturned) {
@ -124,8 +124,9 @@ TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToGreaterRootDeviceThanAvailable
auto devices = DeviceFactory::createDevices(*executionEnvironment); auto devices = DeviceFactory::createDevices(*executionEnvironment);
EXPECT_EQ(devices.size(), 2u); EXPECT_EQ(devices.size(), 2u);
EXPECT_EQ(devices[0]->getNumAvailableDevices(), 4u); EXPECT_EQ(devices[0]->getNumSubDevices(), 4u);
EXPECT_EQ(devices[1]->getNumAvailableDevices(), 1u); EXPECT_EQ(devices[1]->getNumGenericSubDevices(), 0u);
EXPECT_EQ(devices[1]->getNumSubDevices(), 0u);
} }
TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToGreaterSubDeviceThanAvailableWhenCreateDevicesThenProperNumberOfDevicesIsReturned) { TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToGreaterSubDeviceThanAvailableWhenCreateDevicesThenProperNumberOfDevicesIsReturned) {
@ -139,7 +140,7 @@ TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToGreaterSubDeviceThanAvailableW
auto devices = DeviceFactory::createDevices(*executionEnvironment); auto devices = DeviceFactory::createDevices(*executionEnvironment);
EXPECT_EQ(devices.size(), 1u); EXPECT_EQ(devices.size(), 1u);
EXPECT_EQ(devices[0]->getNumAvailableDevices(), 4u); EXPECT_EQ(devices[0]->getNumSubDevices(), 4u);
} }
TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToRootDevicesOnlyWhenCreateDevicesThenProperNumberOfDevicesIsReturned) { TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToRootDevicesOnlyWhenCreateDevicesThenProperNumberOfDevicesIsReturned) {
@ -153,8 +154,8 @@ TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToRootDevicesOnlyWhenCreateDevic
auto devices = DeviceFactory::createDevices(*executionEnvironment); auto devices = DeviceFactory::createDevices(*executionEnvironment);
EXPECT_EQ(devices.size(), 2u); EXPECT_EQ(devices.size(), 2u);
EXPECT_EQ(devices[0]->getNumAvailableDevices(), 4u); EXPECT_EQ(devices[0]->getNumSubDevices(), 4u);
EXPECT_EQ(devices[1]->getNumAvailableDevices(), 4u); EXPECT_EQ(devices[1]->getNumSubDevices(), 4u);
} }
TEST_F(DeviceFactoryTest, WhenOverridingEngineTypeThenDebugEngineIsReported) { TEST_F(DeviceFactoryTest, WhenOverridingEngineTypeThenDebugEngineIsReported) {

View File

@ -27,7 +27,8 @@ XEHPTEST_F(XeHPUsDeviceIdTest, givenRevisionAWhenCreatingEngineWithSubdevicesThe
MockDevice device(executionEnvironment, 0); MockDevice device(executionEnvironment, 0);
EXPECT_EQ(0u, device.engines.size()); EXPECT_EQ(0u, device.engines.size());
device.createSubDevices(); device.createSubDevices();
EXPECT_EQ(2u, device.getNumAvailableDevices()); device.createEngines();
EXPECT_EQ(2u, device.getNumGenericSubDevices());
auto hwInfo = device.getRootDeviceEnvironment().getMutableHardwareInfo(); auto hwInfo = device.getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily); const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
@ -47,7 +48,8 @@ XEHPTEST_F(XeHPUsDeviceIdTest, givenRevisionBWhenCreatingEngineWithSubdevicesThe
MockDevice device(executionEnvironment, 0); MockDevice device(executionEnvironment, 0);
EXPECT_EQ(0u, device.engines.size()); EXPECT_EQ(0u, device.engines.size());
device.createSubDevices(); device.createSubDevices();
EXPECT_EQ(2u, device.getNumAvailableDevices()); device.createEngines();
EXPECT_EQ(2u, device.getNumGenericSubDevices());
auto hwInfo = device.getRootDeviceEnvironment().getMutableHardwareInfo(); auto hwInfo = device.getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily); const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);

View File

@ -52,7 +52,7 @@ ErrorCode CommandContainer::initialize(Device *device) {
true /* allocateMemory*/, true /* allocateMemory*/,
alignedSize, alignedSize,
GraphicsAllocation::AllocationType::COMMAND_BUFFER, GraphicsAllocation::AllocationType::COMMAND_BUFFER,
(device->getNumAvailableDevices() > 1u) /* multiOsContextCapable */, (device->getNumGenericSubDevices() > 1u) /* multiOsContextCapable */,
false, false,
device->getDeviceBitfield()}; device->getDeviceBitfield()};
@ -72,7 +72,7 @@ ErrorCode CommandContainer::initialize(Device *device) {
} }
constexpr size_t heapSize = 65536u; constexpr size_t heapSize = 65536u;
heapHelper = std::unique_ptr<HeapHelper>(new HeapHelper(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumAvailableDevices() > 1u)); heapHelper = std::unique_ptr<HeapHelper>(new HeapHelper(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumGenericSubDevices() > 1u));
for (uint32_t i = 0; i < IndirectHeap::Type::NUM_TYPES; i++) { for (uint32_t i = 0; i < IndirectHeap::Type::NUM_TYPES; i++) {
if (NEO::ApiSpecificConfig::getBindlessConfiguration() && i != IndirectHeap::INDIRECT_OBJECT) { if (NEO::ApiSpecificConfig::getBindlessConfiguration() && i != IndirectHeap::INDIRECT_OBJECT) {
@ -226,7 +226,7 @@ void CommandContainer::allocateNextCommandBuffer() {
true /* allocateMemory*/, true /* allocateMemory*/,
alignedSize, alignedSize,
GraphicsAllocation::AllocationType::COMMAND_BUFFER, GraphicsAllocation::AllocationType::COMMAND_BUFFER,
(device->getNumAvailableDevices() > 1u) /* multiOsContextCapable */, (device->getNumGenericSubDevices() > 1u) /* multiOsContextCapable */,
false, false,
device->getDeviceBitfield()}; device->getDeviceBitfield()};

View File

@ -535,7 +535,7 @@ bool CommandStreamReceiver::createWorkPartitionAllocation(const Device &device)
if (!staticWorkPartitioningEnabled) { if (!staticWorkPartitioningEnabled) {
return false; return false;
} }
UNRECOVERABLE_IF(device.getNumAvailableDevices() < 2); UNRECOVERABLE_IF(device.getNumGenericSubDevices() < 2);
AllocationProperties properties{this->rootDeviceIndex, true, 4096u, GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE, true, false, deviceBitfield}; AllocationProperties properties{this->rootDeviceIndex, true, 4096u, GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE, true, false, deviceBitfield};
this->workPartitionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties); this->workPartitionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);

View File

@ -479,11 +479,8 @@ bool Device::getHostTimer(uint64_t *hostTimestamp) const {
return getOSTime()->getCpuTime(hostTimestamp); return getOSTime()->getCpuTime(hostTimestamp);
} }
uint32_t Device::getNumAvailableDevices() const { uint32_t Device::getNumGenericSubDevices() const {
if (subdevices.empty()) { return (hasRootCsr() ? getNumSubDevices() : 0);
return 1u;
}
return getNumSubDevices();
} }
Device *Device::getSubDevice(uint32_t deviceId) const { Device *Device::getSubDevice(uint32_t deviceId) const {

View File

@ -108,7 +108,7 @@ class Device : public ReferenceTrackedObject<Device> {
void allocateSyncBufferHandler(); void allocateSyncBufferHandler();
virtual uint32_t getRootDeviceIndex() const = 0; virtual uint32_t getRootDeviceIndex() const = 0;
uint32_t getNumAvailableDevices() const; uint32_t getNumGenericSubDevices() const;
Device *getSubDevice(uint32_t deviceId) const; Device *getSubDevice(uint32_t deviceId) const;
Device *getNearestGenericSubDevice(uint32_t deviceId); Device *getNearestGenericSubDevice(uint32_t deviceId);
virtual Device *getRootDevice() const = 0; virtual Device *getRootDevice() const = 0;

View File

@ -39,7 +39,7 @@ Device *RootDevice::getRootDevice() const {
void RootDevice::createBindlessHeapsHelper() { void RootDevice::createBindlessHeapsHelper() {
if (ApiSpecificConfig::getBindlessConfiguration()) { if (ApiSpecificConfig::getBindlessConfiguration()) {
this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->createBindlessHeapsHelper(getMemoryManager(), getNumAvailableDevices() > 1, rootDeviceIndex); this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->createBindlessHeapsHelper(getMemoryManager(), getNumGenericSubDevices() > 1, rootDeviceIndex);
} }
} }

View File

@ -47,7 +47,7 @@ Device *SubDevice::getRootDevice() const {
uint64_t SubDevice::getGlobalMemorySize(uint32_t deviceBitfield) const { uint64_t SubDevice::getGlobalMemorySize(uint32_t deviceBitfield) const {
auto globalMemorySize = Device::getGlobalMemorySize(static_cast<uint32_t>(maxNBitValue(rootDevice.getNumSubDevices()))); auto globalMemorySize = Device::getGlobalMemorySize(static_cast<uint32_t>(maxNBitValue(rootDevice.getNumSubDevices())));
return globalMemorySize / rootDevice.getNumAvailableDevices(); return globalMemorySize / std::max(rootDevice.getNumGenericSubDevices(), 1u);
} }
} // namespace NEO } // namespace NEO

View File

@ -34,13 +34,13 @@ TEST(BindlessHeapsHelper, givenBindlessModeFlagDisabledWhenCreatingRootDevicesTh
using BindlessHeapsHelperTests = Test<MemManagerFixture>; using BindlessHeapsHelperTests = Test<MemManagerFixture>;
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenItsCreatedThenSpecialSshAllocatedAtHeapBegining) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenItsCreatedThenSpecialSshAllocatedAtHeapBegining) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
auto specialSshAllocation = bindlessHeapHelper->specialSsh->getGraphicsAllocation(); auto specialSshAllocation = bindlessHeapHelper->specialSsh->getGraphicsAllocation();
EXPECT_EQ(specialSshAllocation->getGpuAddress(), specialSshAllocation->getGpuBaseAddress()); EXPECT_EQ(specialSshAllocation->getGpuAddress(), specialSshAllocation->getGpuBaseAddress());
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThenHeapUsedSpaceGrow) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThenHeapUsedSpaceGrow) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
auto usedBefore = bindlessHeapHelper->globalSsh->getUsed(); auto usedBefore = bindlessHeapHelper->globalSsh->getUsed();
MockGraphicsAllocation alloc; MockGraphicsAllocation alloc;
@ -51,7 +51,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThen
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThenMemoryAtReturnedOffsetIsCorrect) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThenMemoryAtReturnedOffsetIsCorrect) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockGraphicsAllocation alloc; MockGraphicsAllocation alloc;
size_t size = 0x40; size_t size = 0x40;
@ -62,7 +62,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThen
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwiceForTheSameAllocationThenTheSameOffsetReturned) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwiceForTheSameAllocationThenTheSameOffsetReturned) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockGraphicsAllocation alloc; MockGraphicsAllocation alloc;
size_t size = 0x40; size_t size = 0x40;
@ -73,7 +73,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwic
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwiceForDifferentAllocationThenDifferentOffsetsReturned) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwiceForDifferentAllocationThenDifferentOffsetsReturned) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockGraphicsAllocation alloc1; MockGraphicsAllocation alloc1;
MockGraphicsAllocation alloc2; MockGraphicsAllocation alloc2;
@ -87,7 +87,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwic
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocatingMoreSsThenNewHeapAllocationCreated) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocatingMoreSsThenNewHeapAllocationCreated) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
size_t ssSize = 0x40; size_t ssSize = 0x40;
auto ssCount = bindlessHeapHelper->globalSsh->getAvailableSpace() / ssSize; auto ssCount = bindlessHeapHelper->globalSsh->getAvailableSpace() / ssSize;
auto graphicsAllocations = std::make_unique<MockGraphicsAllocation[]>(ssCount); auto graphicsAllocations = std::make_unique<MockGraphicsAllocation[]>(ssCount);
@ -104,27 +104,27 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocatingMoreSsThen
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenCreatedThenAllocationsHaveTheSameBaseAddress) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenCreatedThenAllocationsHaveTheSameBaseAddress) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
for (auto allocation : bindlessHeapHelper->ssHeapsAllocations) { for (auto allocation : bindlessHeapHelper->ssHeapsAllocations) {
EXPECT_EQ(allocation->getGpuBaseAddress(), bindlessHeapHelper->getGlobalHeapsBase()); EXPECT_EQ(allocation->getGpuBaseAddress(), bindlessHeapHelper->getGlobalHeapsBase());
} }
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetCalledThenCorrectOffsetReturned) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetCalledThenCorrectOffsetReturned) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress(); auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress();
EXPECT_EQ(bindlessHeapHelper->getDefaultBorderColorOffset(), expectedOffset); EXPECT_EQ(bindlessHeapHelper->getDefaultBorderColorOffset(), expectedOffset);
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetAlphaBorderColorOffsetCalledThenCorrectOffsetReturned) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetAlphaBorderColorOffsetCalledThenCorrectOffsetReturned) {
auto borderColorSize = 0x40; auto borderColorSize = 0x40;
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress() + borderColorSize; auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress() + borderColorSize;
EXPECT_EQ(bindlessHeapHelper->getAlphaBorderColorOffset(), expectedOffset); EXPECT_EQ(bindlessHeapHelper->getAlphaBorderColorOffset(), expectedOffset);
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInSpecialHeapThenOffsetLessThanFrontWindowSize) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInSpecialHeapThenOffsetLessThanFrontWindowSize) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockGraphicsAllocation alloc; MockGraphicsAllocation alloc;
size_t size = 0x40; size_t size = 0x40;
auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::SPECIAL_SSH); auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::SPECIAL_SSH);
@ -132,7 +132,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInSpecialH
EXPECT_LT(ssInHeapInfo.surfaceStateOffset, frontWindowSize); EXPECT_LT(ssInHeapInfo.surfaceStateOffset, frontWindowSize);
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalHeapThenOffsetLessThanFrontWindowSize) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalHeapThenOffsetLessThanFrontWindowSize) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockGraphicsAllocation alloc; MockGraphicsAllocation alloc;
size_t size = 0x40; size_t size = 0x40;
auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::GLOBAL_SSH); auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::GLOBAL_SSH);
@ -141,7 +141,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalHe
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInScratchHeapThenOffsetLessThanFrontWindowSize) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInScratchHeapThenOffsetLessThanFrontWindowSize) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockGraphicsAllocation alloc; MockGraphicsAllocation alloc;
size_t size = 0x40; size_t size = 0x40;
auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::SCRATCH_SSH); auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::SCRATCH_SSH);
@ -150,7 +150,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInScratchH
} }
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalDshThenOffsetGreaterOrEqualFrontWindowSize) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalDshThenOffsetGreaterOrEqualFrontWindowSize) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockGraphicsAllocation alloc; MockGraphicsAllocation alloc;
size_t size = 0x40; size_t size = 0x40;
auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH); auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
@ -161,7 +161,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalDs
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenFreeGraphicsMemoryIsCalledThenSSinHeapInfoShouldBePlacedInReuseVector) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenFreeGraphicsMemoryIsCalledThenSSinHeapInfoShouldBePlacedInReuseVector) {
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockBindlesHeapsHelper *bindlessHeapHelperPtr = bindlessHeapHelper.get(); MockBindlesHeapsHelper *bindlessHeapHelperPtr = bindlessHeapHelper.get();
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapHelper.release()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
MockGraphicsAllocation *alloc = new MockGraphicsAllocation; MockGraphicsAllocation *alloc = new MockGraphicsAllocation;
@ -177,7 +177,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenFreeGraphicsMemoryIs
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperPreviousAllocationThenItShouldBeReused) { TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperPreviousAllocationThenItShouldBeReused) {
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
MockBindlesHeapsHelper *bindlessHeapHelperPtr = bindlessHeapHelper.get(); MockBindlesHeapsHelper *bindlessHeapHelperPtr = bindlessHeapHelper.get();
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapHelper.release()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
MockGraphicsAllocation *alloc = new MockGraphicsAllocation; MockGraphicsAllocation *alloc = new MockGraphicsAllocation;

View File

@ -37,8 +37,8 @@ UltDeviceFactory::UltDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevice
for (auto &pCreatedDevice : createdDevices) { for (auto &pCreatedDevice : createdDevices) {
pCreatedDevice->incRefInternal(); pCreatedDevice->incRefInternal();
if (pCreatedDevice->getNumAvailableDevices() > 1) { if (pCreatedDevice->getNumSubDevices() > 1) {
for (uint32_t i = 0; i < pCreatedDevice->getNumAvailableDevices(); i++) { for (uint32_t i = 0; i < pCreatedDevice->getNumSubDevices(); i++) {
this->subDevices.push_back(static_cast<SubDevice *>(pCreatedDevice->getSubDevice(i))); this->subDevices.push_back(static_cast<SubDevice *>(pCreatedDevice->getSubDevice(i)));
} }
} }

View File

@ -1156,7 +1156,9 @@ HWTEST_F(BindlessCommandEncodeStatesTesttt, givenBindlessKernelWhenBindlessModeE
auto commandContainer = std::make_unique<CommandContainer>(); auto commandContainer = std::make_unique<CommandContainer>();
commandContainer->initialize(pDevice); commandContainer->initialize(pDevice);
commandContainer->setDirtyStateForAllHeaps(false); commandContainer->setDirtyStateForAllHeaps(false);
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t numBindingTable = 1; uint32_t numBindingTable = 1;
BINDING_TABLE_STATE bindingTableState = FamilyType::cmdInitBindingTableState; BINDING_TABLE_STATE bindingTableState = FamilyType::cmdInitBindingTableState;
@ -1191,7 +1193,9 @@ HWTEST_F(BindlessCommandEncodeStatesTesttt, givenBindfulKernelWhenBindlessModeEn
auto commandContainer = std::make_unique<CommandContainer>(); auto commandContainer = std::make_unique<CommandContainer>();
commandContainer->initialize(pDevice); commandContainer->initialize(pDevice);
commandContainer->setDirtyStateForAllHeaps(false); commandContainer->setDirtyStateForAllHeaps(false);
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t numBindingTable = 1; uint32_t numBindingTable = 1;
BINDING_TABLE_STATE bindingTableState = FamilyType::cmdInitBindingTableState; BINDING_TABLE_STATE bindingTableState = FamilyType::cmdInitBindingTableState;
@ -1226,7 +1230,9 @@ HWTEST_F(BindlessCommandEncodeStatesTesttt, givenBindlessModeEnabledWhenDispatch
auto commandContainer = std::make_unique<CommandContainer>(); auto commandContainer = std::make_unique<CommandContainer>();
commandContainer->initialize(pDevice); commandContainer->initialize(pDevice);
commandContainer->setDirtyStateForAllHeaps(false); commandContainer->setDirtyStateForAllHeaps(false);
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t numBindingTable = 1; uint32_t numBindingTable = 1;
BINDING_TABLE_STATE bindingTableState = FamilyType::cmdInitBindingTableState; BINDING_TABLE_STATE bindingTableState = FamilyType::cmdInitBindingTableState;
@ -1274,7 +1280,9 @@ HWTEST_F(BindlessCommandEncodeStatesTest, givenGlobalBindlessHeapsWhenDispatchin
uint32_t numSamplers = 1; uint32_t numSamplers = 1;
SAMPLER_BORDER_COLOR_STATE samplerState; SAMPLER_BORDER_COLOR_STATE samplerState;
samplerState.init(); samplerState.init();
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t dims[] = {2, 1, 1}; uint32_t dims[] = {2, 1, 1};
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder()); std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
@ -1305,7 +1313,9 @@ HWTEST_F(BindlessCommandEncodeStatesTest, givenBindlessModeDisabledelWithSampler
uint32_t numSamplers = 1; uint32_t numSamplers = 1;
SAMPLER_STATE samplerState; SAMPLER_STATE samplerState;
memset(&samplerState, 2, sizeof(SAMPLER_STATE)); memset(&samplerState, 2, sizeof(SAMPLER_STATE));
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t dims[] = {2, 1, 1}; uint32_t dims[] = {2, 1, 1};
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder()); std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());

View File

@ -59,7 +59,9 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1; uint32_t numSamplers = 1;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t borderColorSize = 0x40; uint32_t borderColorSize = 0x40;
SAMPLER_BORDER_COLOR_STATE samplerState; SAMPLER_BORDER_COLOR_STATE samplerState;
@ -78,7 +80,9 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1; uint32_t numSamplers = 1;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t borderColorSize = 0x40; uint32_t borderColorSize = 0x40;
SAMPLER_BORDER_COLOR_STATE samplerState; SAMPLER_BORDER_COLOR_STATE samplerState;
@ -98,7 +102,9 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsRe
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1; uint32_t numSamplers = 1;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t borderColorSize = 0x40; uint32_t borderColorSize = 0x40;
SAMPLER_BORDER_COLOR_STATE samplerState; SAMPLER_BORDER_COLOR_STATE samplerState;
@ -114,7 +120,9 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGr
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1; uint32_t numSamplers = 1;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t borderColorSize = 0x40; uint32_t borderColorSize = 0x40;
SAMPLER_BORDER_COLOR_STATE samplerState; SAMPLER_BORDER_COLOR_STATE samplerState;
@ -130,7 +138,9 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBl
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1; uint32_t numSamplers = 1;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t borderColorSize = 0x40; uint32_t borderColorSize = 0x40;
SAMPLER_BORDER_COLOR_STATE samplerState; SAMPLER_BORDER_COLOR_STATE samplerState;
@ -146,7 +156,9 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAl
DebugManager.flags.UseBindlessMode.set(1); DebugManager.flags.UseBindlessMode.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1; uint32_t numSamplers = 1;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex());
uint32_t borderColorSize = 0x40; uint32_t borderColorSize = 0x40;
SAMPLER_BORDER_COLOR_STATE samplerState; SAMPLER_BORDER_COLOR_STATE samplerState;

View File

@ -77,7 +77,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchComtrolerTests, givenDirtyScratchAllocationO
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(), std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv, *execEnv,
*csr.getInternalAllocationStorage()); *csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
bool gsbaStateDirty = false; bool gsbaStateDirty = false;
bool frontEndStateDirty = false; bool frontEndStateDirty = false;
scratchController->scratchDirty = true; scratchController->scratchDirty = true;
@ -97,7 +97,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchComtrolerTests, givenNotDirtyScratchAllocati
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(), std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv, *execEnv,
*csr.getInternalAllocationStorage()); *csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
bool gsbaStateDirty = false; bool gsbaStateDirty = false;
bool frontEndStateDirty = false; bool frontEndStateDirty = false;
scratchController->scratchDirty = false; scratchController->scratchDirty = false;
@ -119,7 +119,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchComtrolerTests, givenPrivateScratchEnabledWh
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(), std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv, *execEnv,
*csr.getInternalAllocationStorage()); *csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
bool gsbaStateDirty = false; bool gsbaStateDirty = false;
bool frontEndStateDirty = false; bool frontEndStateDirty = false;
scratchController->scratchDirty = true; scratchController->scratchDirty = true;
@ -141,7 +141,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchComtrolerTests, givenPrivateScratchDisabledW
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(), std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv, *execEnv,
*csr.getInternalAllocationStorage()); *csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()); auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex());
bool gsbaStateDirty = false; bool gsbaStateDirty = false;
bool frontEndStateDirty = false; bool frontEndStateDirty = false;
scratchController->scratchDirty = true; scratchController->scratchDirty = true;