mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Add SubDevice support for Sysman Memory module
Change-Id: Iec5918486fc2c00e14de074aca18e6de63ba1600 Signed-off-by: SaiKishore Konda <saikishore.konda@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
2d27570292
commit
e28f937683
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
LinuxMemoryImp::LinuxMemoryImp(OsSysman *pOsSysman) {
|
||||
LinuxMemoryImp::LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) : isSubdevice(onSubdevice), subdeviceId(subdeviceId) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pDrm = &pLinuxSysmanImp->getDrm();
|
||||
pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
@@ -26,8 +26,8 @@ bool LinuxMemoryImp::isMemoryModuleSupported() {
|
||||
ze_result_t LinuxMemoryImp::getProperties(zes_mem_properties_t *pProperties) {
|
||||
pProperties->type = ZES_MEM_TYPE_DDR;
|
||||
pProperties->location = ZES_MEM_LOC_DEVICE;
|
||||
pProperties->onSubdevice = false;
|
||||
pProperties->subdeviceId = 0;
|
||||
pProperties->onSubdevice = isSubdevice;
|
||||
pProperties->subdeviceId = subdeviceId;
|
||||
pProperties->busWidth = -1;
|
||||
pProperties->numChannels = -1;
|
||||
pProperties->physicalSize = 0;
|
||||
@@ -60,8 +60,8 @@ ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
OsMemory *OsMemory::create(OsSysman *pOsSysman) {
|
||||
LinuxMemoryImp *pLinuxMemoryImp = new LinuxMemoryImp(pOsSysman);
|
||||
OsMemory *OsMemory::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) {
|
||||
LinuxMemoryImp *pLinuxMemoryImp = new LinuxMemoryImp(pOsSysman, onSubdevice, subdeviceId);
|
||||
return static_cast<OsMemory *>(pLinuxMemoryImp);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,16 @@ class LinuxMemoryImp : public OsMemory, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t getBandwidth(zes_mem_bandwidth_t *pBandwidth) override;
|
||||
ze_result_t getState(zes_mem_state_t *pState) override;
|
||||
bool isMemoryModuleSupported() override;
|
||||
LinuxMemoryImp(OsSysman *pOsSysman);
|
||||
LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);
|
||||
LinuxMemoryImp() = default;
|
||||
~LinuxMemoryImp() override = default;
|
||||
|
||||
protected:
|
||||
NEO::Drm *pDrm = nullptr;
|
||||
Device *pDevice = nullptr;
|
||||
|
||||
private:
|
||||
bool isSubdevice = false;
|
||||
uint32_t subdeviceId = 0;
|
||||
};
|
||||
} // namespace L0
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
LinuxMemoryImp::LinuxMemoryImp(OsSysman *pOsSysman) {
|
||||
LinuxMemoryImp::LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) : isSubdevice(onSubdevice), subdeviceId(subdeviceId) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
}
|
||||
@@ -20,9 +20,16 @@ bool LinuxMemoryImp::isMemoryModuleSupported() {
|
||||
}
|
||||
|
||||
ze_result_t LinuxMemoryImp::getProperties(zes_mem_properties_t *pProperties) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
pProperties->type = ZES_MEM_TYPE_DDR;
|
||||
pProperties->location = ZES_MEM_LOC_DEVICE;
|
||||
pProperties->onSubdevice = isSubdevice;
|
||||
pProperties->subdeviceId = subdeviceId;
|
||||
pProperties->busWidth = -1;
|
||||
pProperties->numChannels = -1;
|
||||
pProperties->physicalSize = 0;
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
ze_result_t LinuxMemoryImp::getBandwidth(zes_mem_bandwidth_t *pBandwidth) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
@@ -31,8 +38,8 @@ ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
OsMemory *OsMemory::create(OsSysman *pOsSysman) {
|
||||
LinuxMemoryImp *pLinuxMemoryImp = new LinuxMemoryImp(pOsSysman);
|
||||
OsMemory *OsMemory::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) {
|
||||
LinuxMemoryImp *pLinuxMemoryImp = new LinuxMemoryImp(pOsSysman, onSubdevice, subdeviceId);
|
||||
return static_cast<OsMemory *>(pLinuxMemoryImp);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,15 @@ class LinuxMemoryImp : public OsMemory, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t getBandwidth(zes_mem_bandwidth_t *pBandwidth) override;
|
||||
ze_result_t getState(zes_mem_state_t *pState) override;
|
||||
bool isMemoryModuleSupported() override;
|
||||
LinuxMemoryImp(OsSysman *pOsSysman);
|
||||
LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);
|
||||
LinuxMemoryImp() = default;
|
||||
~LinuxMemoryImp() override = default;
|
||||
|
||||
protected:
|
||||
Device *pDevice = nullptr;
|
||||
|
||||
private:
|
||||
bool isSubdevice = false;
|
||||
uint32_t subdeviceId = 0;
|
||||
};
|
||||
} // namespace L0
|
||||
|
||||
@@ -19,8 +19,8 @@ MemoryHandleContext::~MemoryHandleContext() {
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryHandleContext::createHandle() {
|
||||
Memory *pMemory = new MemoryImp(pOsSysman);
|
||||
void MemoryHandleContext::createHandle(ze_device_handle_t deviceHandle) {
|
||||
Memory *pMemory = new MemoryImp(pOsSysman, deviceHandle);
|
||||
if (pMemory->initSuccess == true) {
|
||||
handleList.push_back(pMemory);
|
||||
} else {
|
||||
@@ -28,8 +28,10 @@ void MemoryHandleContext::createHandle() {
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t MemoryHandleContext::init() {
|
||||
createHandle();
|
||||
ze_result_t MemoryHandleContext::init(std::vector<ze_device_handle_t> &deviceHandles) {
|
||||
for (auto deviceHandle : deviceHandles) {
|
||||
createHandle(deviceHandle);
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include <vector>
|
||||
@@ -35,7 +36,7 @@ struct MemoryHandleContext {
|
||||
MemoryHandleContext(OsSysman *pOsSysman) : pOsSysman(pOsSysman){};
|
||||
~MemoryHandleContext();
|
||||
|
||||
ze_result_t init();
|
||||
ze_result_t init(std::vector<ze_device_handle_t> &deviceHandles);
|
||||
|
||||
ze_result_t memoryGet(uint32_t *pCount, zes_mem_handle_t *phMemory);
|
||||
|
||||
@@ -44,7 +45,7 @@ struct MemoryHandleContext {
|
||||
std::vector<Memory *> handleList = {};
|
||||
|
||||
private:
|
||||
void createHandle();
|
||||
void createHandle(ze_device_handle_t deviceHandle);
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -29,8 +29,10 @@ void MemoryImp::init() {
|
||||
}
|
||||
}
|
||||
|
||||
MemoryImp::MemoryImp(OsSysman *pOsSysman) {
|
||||
pOsMemory = OsMemory::create(pOsSysman);
|
||||
MemoryImp::MemoryImp(OsSysman *pOsSysman, ze_device_handle_t handle) : deviceHandle(handle) {
|
||||
ze_device_properties_t deviceProperties = {};
|
||||
Device::fromHandle(deviceHandle)->getProperties(&deviceProperties);
|
||||
pOsMemory = OsMemory::create(pOsSysman, deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE, deviceProperties.subdeviceId);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class MemoryImp : public Memory, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t memoryGetBandwidth(zes_mem_bandwidth_t *pBandwidth) override;
|
||||
ze_result_t memoryGetState(zes_mem_state_t *pState) override;
|
||||
|
||||
MemoryImp(OsSysman *pOsSysman);
|
||||
MemoryImp(OsSysman *pOsSysman, ze_device_handle_t handle);
|
||||
~MemoryImp() override;
|
||||
|
||||
MemoryImp() = default;
|
||||
@@ -29,6 +29,7 @@ class MemoryImp : public Memory, NEO::NonCopyableOrMovableClass {
|
||||
|
||||
private:
|
||||
zes_mem_properties_t memoryProperties = {};
|
||||
ze_device_handle_t deviceHandle = nullptr;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -18,7 +18,7 @@ class OsMemory {
|
||||
virtual ze_result_t getBandwidth(zes_mem_bandwidth_t *pBandwidth) = 0;
|
||||
virtual ze_result_t getState(zes_mem_state_t *pState) = 0;
|
||||
virtual bool isMemoryModuleSupported() = 0;
|
||||
static OsMemory *create(OsSysman *pOsSysman);
|
||||
static OsMemory *create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);
|
||||
virtual ~OsMemory() {}
|
||||
};
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ ze_result_t WddmMemoryImp::getProperties(zes_mem_properties_t *pProperties) {
|
||||
KmdSysman::RequestProperty request;
|
||||
KmdSysman::ResponseProperty response;
|
||||
|
||||
pProperties->onSubdevice = false;
|
||||
pProperties->subdeviceId = 0;
|
||||
pProperties->onSubdevice = isSubdevice;
|
||||
pProperties->subdeviceId = subdeviceId;
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::MemoryComponent;
|
||||
@@ -176,14 +176,14 @@ ze_result_t WddmMemoryImp::getState(zes_mem_state_t *pState) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
WddmMemoryImp::WddmMemoryImp(OsSysman *pOsSysman) {
|
||||
WddmMemoryImp::WddmMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) : isSubdevice(onSubdevice), subdeviceId(subdeviceId) {
|
||||
WddmSysmanImp *pWddmSysmanImp = static_cast<WddmSysmanImp *>(pOsSysman);
|
||||
pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||
pDevice = pWddmSysmanImp->getDeviceHandle();
|
||||
}
|
||||
|
||||
OsMemory *OsMemory::create(OsSysman *pOsSysman) {
|
||||
WddmMemoryImp *pWddmMemoryImp = new WddmMemoryImp(pOsSysman);
|
||||
OsMemory *OsMemory::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) {
|
||||
WddmMemoryImp *pWddmMemoryImp = new WddmMemoryImp(pOsSysman, onSubdevice, subdeviceId);
|
||||
return static_cast<OsMemory *>(pWddmMemoryImp);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,13 +22,15 @@ class WddmMemoryImp : public OsMemory, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t getBandwidth(zes_mem_bandwidth_t *pBandwidth) override;
|
||||
ze_result_t getState(zes_mem_state_t *pState) override;
|
||||
bool isMemoryModuleSupported() override;
|
||||
WddmMemoryImp(OsSysman *pOsSysman);
|
||||
WddmMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);
|
||||
WddmMemoryImp() = default;
|
||||
~WddmMemoryImp() override = default;
|
||||
|
||||
protected:
|
||||
KmdSysManager *pKmdSysManager = nullptr;
|
||||
Device *pDevice = nullptr;
|
||||
bool isSubdevice = false;
|
||||
uint32_t subdeviceId = 0;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -94,7 +94,7 @@ void SysmanDeviceImp::init() {
|
||||
pRasHandleContext->init();
|
||||
}
|
||||
if (pMemoryHandleContext) {
|
||||
pMemoryHandleContext->init();
|
||||
pMemoryHandleContext->init(deviceHandles);
|
||||
}
|
||||
if (pGlobalOperations) {
|
||||
pGlobalOperations->init();
|
||||
|
||||
@@ -64,5 +64,34 @@ class SysmanDeviceFixture : public DeviceFixture, public ::testing::Test {
|
||||
PublicLinuxSysmanImp *pLinuxSysmanImp = nullptr;
|
||||
};
|
||||
|
||||
class SysmanMultiDeviceFixture : public MultiDeviceFixture, public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
MultiDeviceFixture::SetUp();
|
||||
device = driverHandle->devices[0];
|
||||
neoDevice = device->getNEODevice();
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->osInterface = std::make_unique<NEO::OSInterface>();
|
||||
auto osInterface = device->getOsInterface().get();
|
||||
osInterface->setDrm(new SysmanMockDrm(const_cast<NEO::RootDeviceEnvironment &>(neoDevice->getRootDeviceEnvironment())));
|
||||
setenv("ZES_ENABLE_SYSMAN", "1", 1);
|
||||
device->setSysmanHandle(L0::SysmanDeviceHandleContext::init(device->toHandle()));
|
||||
pSysmanDevice = device->getSysmanHandle();
|
||||
pSysmanDeviceImp = static_cast<SysmanDeviceImp *>(pSysmanDevice);
|
||||
pOsSysman = pSysmanDeviceImp->pOsSysman;
|
||||
pLinuxSysmanImp = static_cast<PublicLinuxSysmanImp *>(pOsSysman);
|
||||
}
|
||||
void TearDown() override {
|
||||
unsetenv("ZES_ENABLE_SYSMAN");
|
||||
MultiDeviceFixture::TearDown();
|
||||
}
|
||||
|
||||
SysmanDevice *pSysmanDevice = nullptr;
|
||||
SysmanDeviceImp *pSysmanDeviceImp = nullptr;
|
||||
OsSysman *pOsSysman = nullptr;
|
||||
PublicLinuxSysmanImp *pLinuxSysmanImp = nullptr;
|
||||
NEO::Device *neoDevice = nullptr;
|
||||
L0::Device *device = nullptr;
|
||||
};
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -43,7 +43,17 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
|
||||
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init();
|
||||
uint32_t subDeviceCount = 0;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
// We received a device handle. Check for subdevices in this device
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, nullptr);
|
||||
if (subDeviceCount == 0) {
|
||||
deviceHandles.resize(1, device->toHandle());
|
||||
} else {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init(deviceHandles);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
@@ -68,7 +78,17 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
|
||||
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init();
|
||||
uint32_t subDeviceCount = 0;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
// We received a device handle. Check for subdevices in this device
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, nullptr);
|
||||
if (subDeviceCount == 0) {
|
||||
deviceHandles.resize(1, device->toHandle());
|
||||
} else {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init(deviceHandles);
|
||||
}
|
||||
|
||||
std::vector<zes_mem_handle_t> get_memory_handles(uint32_t count) {
|
||||
@@ -225,5 +245,18 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzetSysmanMemo
|
||||
EXPECT_EQ(zesMemoryGetState(handle, &state), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanMultiDeviceFixture, GivenValidDevicePointerWhenGettingMemoryPropertiesThenValidMemoryPropertiesRetrieved) {
|
||||
zes_mem_properties_t properties = {};
|
||||
ze_device_properties_t deviceProperties = {};
|
||||
ze_bool_t isSubDevice = deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE;
|
||||
Device::fromHandle(device)->getProperties(&deviceProperties);
|
||||
LinuxMemoryImp *pLinuxMemoryImp = new LinuxMemoryImp(pOsSysman, isSubDevice, deviceProperties.subdeviceId);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxMemoryImp->getProperties(&properties));
|
||||
EXPECT_EQ(properties.subdeviceId, deviceProperties.subdeviceId);
|
||||
EXPECT_EQ(properties.onSubdevice, isSubDevice);
|
||||
delete pLinuxMemoryImp;
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/memory/linux/os_memory_imp.h"
|
||||
#include "level_zero/tools/source/sysman/sysman_imp.h"
|
||||
#include "level_zero/tools/test/unit_tests/sources/sysman/linux/mock_sysman_fixture.h"
|
||||
|
||||
@@ -33,7 +34,17 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
|
||||
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init();
|
||||
uint32_t subDeviceCount = 0;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
// We received a device handle. Check for subdevices in this device
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, nullptr);
|
||||
if (subDeviceCount == 0) {
|
||||
deviceHandles.resize(1, device->toHandle());
|
||||
} else {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init(deviceHandles);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
@@ -53,7 +64,17 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
|
||||
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init();
|
||||
uint32_t subDeviceCount = 0;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
// We received a device handle. Check for subdevices in this device
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, nullptr);
|
||||
if (subDeviceCount == 0) {
|
||||
deviceHandles.resize(1, device->toHandle());
|
||||
} else {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init(deviceHandles);
|
||||
}
|
||||
|
||||
std::vector<zes_mem_handle_t> get_memory_handles(uint32_t count) {
|
||||
@@ -145,5 +166,17 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzetSysmanMemo
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanMultiDeviceFixture, GivenValidDevicePointerWhenGettingMemoryPropertiesThenValidMemoryPropertiesRetrieved) {
|
||||
zes_mem_properties_t properties = {};
|
||||
ze_device_properties_t deviceProperties = {};
|
||||
ze_bool_t isSubDevice = deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE;
|
||||
Device::fromHandle(device)->getProperties(&deviceProperties);
|
||||
LinuxMemoryImp *pLinuxMemoryImp = new LinuxMemoryImp(pOsSysman, isSubDevice, deviceProperties.subdeviceId);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxMemoryImp->getProperties(&properties));
|
||||
EXPECT_EQ(properties.subdeviceId, deviceProperties.subdeviceId);
|
||||
EXPECT_EQ(properties.onSubdevice, isSubDevice);
|
||||
delete pLinuxMemoryImp;
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -41,7 +41,17 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
|
||||
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init();
|
||||
uint32_t subDeviceCount = 0;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
// We received a device handle. Check for subdevices in this device
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, nullptr);
|
||||
if (subDeviceCount == 0) {
|
||||
deviceHandles.resize(1, device->toHandle());
|
||||
} else {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init(deviceHandles);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
@@ -66,7 +76,17 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
|
||||
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init();
|
||||
uint32_t subDeviceCount = 0;
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
// We received a device handle. Check for subdevices in this device
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, nullptr);
|
||||
if (subDeviceCount == 0) {
|
||||
deviceHandles.resize(1, device->toHandle());
|
||||
} else {
|
||||
deviceHandles.resize(subDeviceCount, nullptr);
|
||||
Device::fromHandle(device->toHandle())->getSubDevices(&subDeviceCount, deviceHandles.data());
|
||||
}
|
||||
pSysmanDeviceImp->pMemoryHandleContext->init(deviceHandles);
|
||||
}
|
||||
|
||||
std::vector<zes_mem_handle_t> get_memory_handles(uint32_t count) {
|
||||
|
||||
Reference in New Issue
Block a user