mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
feature: Implement support for zeDeviceGetStatus
Added support for zeDeviceGetStatus API. Added ULTs for zeDeviceGetStatus API. Related-To: LOCI-1558 Signed-off-by: Zhang, Winston <winston.zhang@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
befb9fca58
commit
44a8610ebb
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -101,7 +101,7 @@ ze_result_t zeDeviceGetExternalMemoryProperties(
|
||||
|
||||
ze_result_t zeDeviceGetStatus(
|
||||
ze_device_handle_t hDevice) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
return L0::Device::fromHandle(hDevice)->getStatus();
|
||||
}
|
||||
|
||||
ze_result_t zeDeviceGetGlobalTimestamps(
|
||||
@@ -289,4 +289,4 @@ ze_result_t zeDevicePciGetPropertiesExt(
|
||||
ze_pci_ext_properties_t *pPciProperties) {
|
||||
return L0::zeDevicePciGetPropertiesExt(hDevice, pPciProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ struct Device : _ze_device_handle_t {
|
||||
virtual ze_result_t getProperties(ze_device_properties_t *pDeviceProperties) = 0;
|
||||
virtual ze_result_t getSubDevices(uint32_t *pCount, ze_device_handle_t *phSubdevices) = 0;
|
||||
virtual ze_result_t getCacheProperties(uint32_t *pCount, ze_device_cache_properties_t *pCacheProperties) = 0;
|
||||
virtual ze_result_t getStatus() = 0;
|
||||
virtual ze_result_t reserveCache(size_t cacheLevel, size_t cacheReservationSize) = 0;
|
||||
virtual ze_result_t setCacheAdvice(void *ptr, size_t regionSize, ze_cache_ext_region_t cacheRegion) = 0;
|
||||
virtual ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) = 0;
|
||||
|
||||
@@ -74,6 +74,13 @@ void DeviceImp::setDriverHandle(DriverHandle *driverHandle) {
|
||||
this->driverHandle = driverHandle;
|
||||
}
|
||||
|
||||
ze_result_t DeviceImp::getStatus() {
|
||||
if (this->resourcesReleased) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_t *value) {
|
||||
DeviceImp *pPeerDevice = static_cast<DeviceImp *>(Device::fromHandle(hPeerDevice));
|
||||
uint32_t peerRootDeviceIndex = pPeerDevice->getNEODevice()->getRootDeviceIndex();
|
||||
|
||||
@@ -31,6 +31,7 @@ class CacheReservation;
|
||||
|
||||
struct DeviceImp : public Device {
|
||||
DeviceImp();
|
||||
ze_result_t getStatus() override;
|
||||
ze_result_t submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_t *value);
|
||||
MOCKABLE_VIRTUAL ze_result_t queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latency, uint32_t &bandwidth);
|
||||
ze_result_t canAccessPeer(ze_device_handle_t hPeerDevice, ze_bool_t *value) override;
|
||||
|
||||
@@ -38,6 +38,7 @@ struct Mock<Device> : public Device {
|
||||
ADDMETHOD_NOBASE(createImage, ze_result_t, ZE_RESULT_SUCCESS, (const ze_image_desc_t *desc, ze_image_handle_t *phImage));
|
||||
ADDMETHOD_NOBASE(createModule, ze_result_t, ZE_RESULT_SUCCESS, (const ze_module_desc_t *desc, ze_module_handle_t *module, ze_module_build_log_handle_t *buildLog, ModuleType type));
|
||||
ADDMETHOD_NOBASE(createSampler, ze_result_t, ZE_RESULT_SUCCESS, (const ze_sampler_desc_t *pDesc, ze_sampler_handle_t *phSampler));
|
||||
ADDMETHOD_NOBASE(getStatus, ze_result_t, ZE_RESULT_SUCCESS, ());
|
||||
ADDMETHOD_NOBASE(getComputeProperties, ze_result_t, ZE_RESULT_SUCCESS, (ze_device_compute_properties_t * pComputeProperties));
|
||||
ADDMETHOD_NOBASE(getP2PProperties, ze_result_t, ZE_RESULT_SUCCESS, (ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t *pP2PProperties));
|
||||
ADDMETHOD_NOBASE(getKernelProperties, ze_result_t, ZE_RESULT_SUCCESS, (ze_device_module_properties_t * pKernelProperties));
|
||||
|
||||
@@ -2421,6 +2421,18 @@ HWTEST_F(MultipleDevicesDisabledImplicitScalingTest, givenTwoRootDevicesFromSame
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, res);
|
||||
}
|
||||
|
||||
using DeviceGetStatusTest = Test<DeviceFixture>;
|
||||
TEST_F(DeviceGetStatusTest, givenCallToDeviceGetStatusThenCorrectErrorCodeIsReturnedWhenResourcesHaveBeenReleased) {
|
||||
L0::DeviceImp *deviceImp = static_cast<DeviceImp *>(device);
|
||||
|
||||
ze_result_t res = device->getStatus();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
deviceImp->releaseResources();
|
||||
res = device->getStatus();
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, res);
|
||||
}
|
||||
|
||||
using DeviceTests = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(DeviceTests, WhenGettingMemoryAccessPropertiesThenSuccessIsReturned) {
|
||||
|
||||
Reference in New Issue
Block a user