mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 17:13:29 +08:00
feature: atomic attributes for shared system alloc
Related-To: NEO-13715, NEO-14862 Signed-off-by: Chandio, Bibrak Qamar <bibrak.qamar.chandio@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
cb4fa456b7
commit
c1867ed981
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2024 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/device/root_device.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
|
||||
#include <iostream>
|
||||
namespace NEO {
|
||||
|
||||
SubDevice::SubDevice(ExecutionEnvironment *executionEnvironment, uint32_t subDeviceIndex, Device &rootDevice)
|
||||
@@ -35,6 +37,34 @@ uint32_t SubDevice::getSubDeviceIndex() const {
|
||||
return subDeviceIndex;
|
||||
}
|
||||
|
||||
NEO::SubDeviceIdsVec SubDevice::getSubDeviceIdsFromDevice(NEO::Device &device) {
|
||||
|
||||
NEO::SubDeviceIdsVec subDeviceIds;
|
||||
|
||||
if (device.getNumSubDevices() == 0) {
|
||||
subDeviceIds.push_back(NEO::SubDevice::getSubDeviceId(device));
|
||||
} else {
|
||||
for (auto &subDevice : device.getSubDevices()) {
|
||||
if (subDevice == nullptr) {
|
||||
continue;
|
||||
}
|
||||
subDeviceIds.push_back(NEO::SubDevice::getSubDeviceId(*subDevice));
|
||||
}
|
||||
}
|
||||
return subDeviceIds;
|
||||
}
|
||||
|
||||
uint32_t SubDevice::getSubDeviceId(NEO::Device &device) {
|
||||
if (!device.isSubDevice()) {
|
||||
uint32_t deviceBitField = static_cast<uint32_t>(device.getDeviceBitfield().to_ulong());
|
||||
if (device.getDeviceBitfield().count() > 1) {
|
||||
deviceBitField &= ~deviceBitField + 1;
|
||||
}
|
||||
return Math::log2(deviceBitField);
|
||||
}
|
||||
return static_cast<NEO::SubDevice *>(&device)->getSubDeviceIndex();
|
||||
}
|
||||
|
||||
Device *SubDevice::getRootDevice() const {
|
||||
return &rootDevice;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user