Add support for zeContextGetStatus()
Change-Id: Idf6d7bf462d74720f2e21abad7eaecb297388ff4 Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
parent
7c086c9fb4
commit
bc855e4696
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "shared/source/memory_manager/memory_operations_handler.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/core/source/image/image.h"
|
||||
#include "level_zero/core/source/memory/memory_operations_helper.h"
|
||||
|
||||
|
@ -22,7 +22,14 @@ ze_result_t ContextImp::destroy() {
|
|||
}
|
||||
|
||||
ze_result_t ContextImp::getStatus() {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
DriverHandleImp *driverHandleImp = static_cast<DriverHandleImp *>(this->driverHandle);
|
||||
for (auto device : driverHandleImp->devices) {
|
||||
DeviceImp *deviceImp = static_cast<DeviceImp *>(device);
|
||||
if (deviceImp->resourcesReleased) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
DriverHandle *ContextImp::getDriverHandle() {
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using ContextTest = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(ContextTest, givenCallToContextGetStatusThenUnsupportedIsReturned) {
|
||||
using ContextGetStatusTest = Test<DeviceFixture>;
|
||||
TEST_F(ContextGetStatusTest,
|
||||
givenCallToContextGetStatusThenCorrectErrorCodeIsReturnedWhenResourcesHaveBeenReleased) {
|
||||
ze_context_handle_t hContext;
|
||||
ze_context_desc_t desc;
|
||||
ze_result_t res = driverHandle->createContext(&desc, &hContext);
|
||||
|
@ -27,11 +27,21 @@ TEST_F(ContextTest, givenCallToContextGetStatusThenUnsupportedIsReturned) {
|
|||
L0::Context *context = L0::Context::fromHandle(hContext);
|
||||
|
||||
res = context->getStatus();
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, res);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
for (auto device : driverHandle->devices) {
|
||||
L0::DeviceImp *deviceImp = static_cast<DeviceImp *>(device);
|
||||
deviceImp->releaseResources();
|
||||
}
|
||||
|
||||
res = context->getStatus();
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, res);
|
||||
|
||||
context->destroy();
|
||||
}
|
||||
|
||||
using ContextTest = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(ContextTest, whenCreatingAndDestroyingContextThenSuccessIsReturned) {
|
||||
ze_context_handle_t hContext;
|
||||
ze_context_desc_t desc;
|
||||
|
|
Loading…
Reference in New Issue