mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-31 12:11:31 +08:00
Unify code for check is implicit scaling enabled
Related-To: NEO-6262 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7f1c87f049
commit
357f650b8b
@@ -31,7 +31,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControl(commandStream, args);
|
||||
auto pSbaCmd = static_cast<STATE_BASE_ADDRESS *>(commandStream.getSpace(sizeof(STATE_BASE_ADDRESS)));
|
||||
STATE_BASE_ADDRESS sbaCmd;
|
||||
bool multiOsContextCapable = NEO::ImplicitScalingHelper::isImplicitScalingEnabled(neoDevice->getDeviceBitfield(), true);
|
||||
bool multiOsContextCapable = device->isMultiDeviceCapable();
|
||||
NEO::StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(&sbaCmd,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
@@ -104,7 +104,8 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
|
||||
size_t size,
|
||||
size_t alignment, void **ptr) {
|
||||
|
||||
if (isDeviceDefinedForThisContext(Device::fromHandle(hDevice)) == false) {
|
||||
auto device = Device::fromHandle(hDevice);
|
||||
if (isDeviceDefinedForThisContext(device) == false) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
|
||||
return parseResult;
|
||||
}
|
||||
|
||||
auto neoDevice = Device::fromHandle(hDevice)->getNEODevice();
|
||||
auto neoDevice = device->getNEODevice();
|
||||
auto rootDeviceIndex = neoDevice->getRootDeviceIndex();
|
||||
auto deviceBitfields = this->driverHandle->deviceBitfields;
|
||||
|
||||
@@ -149,7 +150,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
|
||||
uint64_t globalMemSize = neoDevice->getDeviceInfo().globalMemSize;
|
||||
|
||||
uint32_t numSubDevices = neoDevice->getNumGenericSubDevices();
|
||||
if ((!(NEO::ImplicitScalingHelper::isImplicitScalingEnabled(neoDevice->getDeviceBitfield(), true))) && (numSubDevices > 1)) {
|
||||
if ((!device->isMultiDeviceCapable()) && (numSubDevices > 1)) {
|
||||
globalMemSize = globalMemSize / numSubDevices;
|
||||
}
|
||||
if (lookupTable.relaxedSizeAllowed && (size > globalMemSize)) {
|
||||
@@ -184,10 +185,11 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
|
||||
size_t alignment,
|
||||
void **ptr) {
|
||||
|
||||
auto neoDevice = this->devices.begin()->second->getNEODevice();
|
||||
auto device = this->devices.begin()->second;
|
||||
if (hDevice != nullptr) {
|
||||
neoDevice = Device::fromHandle(hDevice)->getNEODevice();
|
||||
device = Device::fromHandle(hDevice);
|
||||
}
|
||||
auto neoDevice = device->getNEODevice();
|
||||
|
||||
bool relaxedSizeAllowed = NEO::DebugManager.flags.AllowUnrestrictedSize.get();
|
||||
if (deviceDesc->pNext) {
|
||||
@@ -211,7 +213,7 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
|
||||
uint64_t globalMemSize = neoDevice->getDeviceInfo().globalMemSize;
|
||||
|
||||
uint32_t numSubDevices = neoDevice->getNumGenericSubDevices();
|
||||
if ((!(NEO::ImplicitScalingHelper::isImplicitScalingEnabled(neoDevice->getDeviceBitfield(), true))) && (numSubDevices > 1)) {
|
||||
if ((!device->isMultiDeviceCapable()) && (numSubDevices > 1)) {
|
||||
globalMemSize = globalMemSize / numSubDevices;
|
||||
}
|
||||
if (relaxedSizeAllowed &&
|
||||
@@ -223,11 +225,12 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
|
||||
auto deviceBitfields = this->deviceBitfields;
|
||||
NEO::Device *unifiedMemoryPropertiesDevice = nullptr;
|
||||
if (hDevice) {
|
||||
if (isDeviceDefinedForThisContext(Device::fromHandle(hDevice)) == false) {
|
||||
device = Device::fromHandle(hDevice);
|
||||
if (isDeviceDefinedForThisContext(device) == false) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
|
||||
neoDevice = Device::fromHandle(hDevice)->getNEODevice();
|
||||
neoDevice = device->getNEODevice();
|
||||
auto rootDeviceIndex = neoDevice->getRootDeviceIndex();
|
||||
unifiedMemoryPropertiesDevice = neoDevice;
|
||||
deviceBitfields[rootDeviceIndex] = neoDevice->getDeviceBitfield();
|
||||
|
||||
@@ -334,7 +334,7 @@ ze_result_t DeviceImp::getMemoryProperties(uint32_t *pCount, ze_device_memory_pr
|
||||
strcpy_s(pMemProperties->name, ZE_MAX_DEVICE_NAME, hwInfoConfig.getDeviceMemoryName().c_str());
|
||||
pMemProperties->maxClockRate = hwInfoConfig.getDeviceMemoryMaxClkRate(&hwInfo);
|
||||
pMemProperties->maxBusWidth = deviceInfo.addressBits;
|
||||
if (NEO::ImplicitScalingHelper::isImplicitScalingEnabled(this->getNEODevice()->getDeviceBitfield(), true) ||
|
||||
if (this->isMultiDeviceCapable() ||
|
||||
this->getNEODevice()->getNumGenericSubDevices() == 0) {
|
||||
pMemProperties->totalSize = deviceInfo.globalMemSize;
|
||||
} else {
|
||||
@@ -491,7 +491,7 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
|
||||
if (NEO::DebugManager.flags.DebugApiUsed.get() == 1) {
|
||||
pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.MaxSubSlicesSupported / hardwareInfo.gtSystemInfo.MaxSlicesSupported;
|
||||
} else {
|
||||
if (NEO::ImplicitScalingHelper::isImplicitScalingEnabled(this->getNEODevice()->getDeviceBitfield(), true) || (this->numSubDevices == 0)) {
|
||||
if (this->isMultiDeviceCapable() || (this->numSubDevices == 0)) {
|
||||
pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.SubSliceCount / hardwareInfo.gtSystemInfo.SliceCount;
|
||||
} else {
|
||||
pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.SubSliceCount / hardwareInfo.gtSystemInfo.SliceCount / this->numSubDevices;
|
||||
|
||||
Reference in New Issue
Block a user